How to determine a dark picture or bright?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
6 views
Good day! Can't tell in which direction to move? Is there a website where displayed "tiled" news (like Yandex), tile consists of a photo and test. How to determine the tone of the photo that would display the text black or white?
by | 6 views

2 Answers

0 like 0 dislike
by
0 like 0 dislike
rgb - average color of the image (or desired area):
getContrastLum function(rgb) { var luminance = 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]; return luminance < 110 ? 'f0f0f0' : '020202'; }
by

Related questions

0 like 0 dislike
7 answers
0 like 0 dislike
5 answers
0 like 0 dislike
1 answer
asked Apr 1, 2019 by anonymous22
0 like 0 dislike
1 answer
asked Apr 1, 2019 by anonymous22
110,608 questions
257,186 answers
0 comments
35,430 users