F
F
froosty2014-11-07 11:07:53
Image processing
froosty, 2014-11-07 11:07:53

How to determine the color that can be used to make an inscription on the image so that it is clearly visible?

Good day. Faced such task. The user uploads an image, the program writes text on it, and returns the image with the text to the user. The question is - how to choose a color that will be clearly visible in the image? Well, i.e. if the image is bestin.ua/static/uploads/news/16_05_12/e282595eb6f... , then we must write the text in white, because black will be hard to see, and if this is t1.moskva.fm/uimg/artists/source/c2/c206c1c8348cd4... , then white text is completely out of topic. Please tell me the solution Thank you in advance

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
DancingOnWater, 2014-11-07
@DancingOnWater

There is such a thing as a color wheel. The most contrasting color to the given one lies through 180 degrees.
Here is a visual demonstration

A
Andrew, 2014-11-07
@OLS

More correct - to look for the most distant point from the current one in the RGB cube (according to the laws of geometry, this will always be the vertex).

invR = (1 - (R div 128))*255
invG = (1 - (G div 128))*255
invB = (1 - (B div 128))*255

R
Rsa97, 2014-11-07
@Rsa97

It is best seen when a contour is made around the letters in a contrasting color to the text, with this method the image can be arbitrarily colorful.

S
SHVV, 2014-11-07
@SHVV

I usually make the text white + dark gray drop shadow.
Works always and everywhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question