Top
Best
New

Posted by dgroshev 4 days ago

Okmain: How to pick an OK main colour of an image(dgroshev.com)
202 points | 40 commentspage 2
vova_hn2 5 hours ago||
> simple 1x1 resize

How is it "simple"? There are like a ton of different downscaling algorithms and each of them might produce a different result.

Cool article otherwise.

gzread 5 hours ago|
At 1x1 I don't expect any difference. It would be the average of all pixels in the image if you don't unevenly weight them (which you might decide when choosing a main color, but no downscaling algorithm would do) and the only difference is whether you remembered to gamma-correct.
vova_hn2 4 hours ago||
Nearest-neighbor interpolation may pick just one pixel closest to the center.
GauntletWizard 3 hours ago||
I really like this approach. I worked on this problem (create a nice background for an image) for a couple weeks many years ago while organizing my desktop wallpaper collection, and never came up with a good answer. Unfortunately, I think that it's been "solved" in the tiktok era; an enlarged and blurred version of the image is used to fill the background space.

The blurred mirror is inoffensive to almost everyone, and yet it always strikes me as gauche. Easy to ignore and yet I feel that it adds a lot of useless visual noise.

airstrike 5 hours ago||
See also https://github.com/material-foundation/material-color-utilit...
useftmly 6 hours ago|
[flagged]
dgroshev 6 hours ago|
Picking the best colour is a difficult problem, I don't think there's a good general answer short of ML magic. I assembled an adversarial collection of images:

https://github.com/si14/okmain/blob/main/test_images/IMG_134...

https://github.com/si14/okmain/blob/main/test_images/pendant...

https://github.com/si14/okmain/blob/main/test_images/pendant...

https://github.com/si14/okmain/blob/main/test_images/red_moo...

https://github.com/si14/okmain/blob/main/test_images/supremu...

For every heuristic, I can think of an image that breaks it. On the other hand, I just wanted to do better than the 1x1 trick, and I think the library clears that bar.

useftmly 5 hours ago||
[flagged]