18 ms·
Colorize
- lokl 6y agoWatermelon. "Average color" is not really what I want.
- robzyb 6y agoDepends on exactly what "average" means in this context. The most naive of interpretations (e.g. averaging each of the R/G/B values) is generally not what we want. Would be super cool to add some different averaging schemes to this.
- rckoepke 6y agoI've done this exercise and generally what you want is a combination of your suggestion (which is elaborated by 'polyphora[0]) and 'p1necone's suggestion [1] Polyphora mentioned CIELAB as just one example, and it's a good example. I believe state of the art these days is Oklab[2], talked about here[3]. I'd like to pull out a comment from 'jiggawatts in that discussion: > This is a tour de force of colour theory, and should be mandatory reading for anyone serious about computer colour! I completely agree. With regards to 'p1necone's suggestion, k-nearest neighbors is one simple and relatively easy way to separate the colors into bins. I've only done this on a single image, but with multiple images maybe you could also k-nn bin the resulting colors from each image and only return bins which have multiple members. 0: https://news.ycombinator.com/item?id=25828733 https://news.ycombinator.com/item?id=25828733 1: https://news.ycombinator.com/item?id=25828773 https://news.ycombinator.com/item?id=25828773 2: https://bottosson.github.io/posts/oklab/ https://bottosson.github.io/posts/oklab/ 3: https://news.ycombinator.com/item?id=25525726 https://news.ycombinator.com/item?id=25525726
- phaedryx 6y agoHah. I was thinking the same thing: https://alexbeals.com/projects/colorize/search.php?q=rainbow https://alexbeals.com/projects/colorize/search.php?q=rainbow
- p1necone 6y agoI wonder if it would be best to return multiple colors when something appears to have multiple primary ones - e.g. black and white for a zebra, green and red for a watermelon. Separating the subject from the background would also be useful - as simple as weighting the center of the image more than the edges?
- Karawebnetwork 6y agoGood idea, except I'm getting shades of brown for almost all queries.
- pvorb 6y agoI also get shades of brown. If you take the mean of any image with many similarly distributed colors, it will be brown. Mean is clearly not the best function for this. It should maybe calculate the dominant color instead.
- mceachen 6y agoReally interesting idea! I was thinking this might be a neat color name-to-rgb tool, but the resulting color deviates substantially from expected colors (which, given the algorithm, is to be expected): https://alexbeals.com/projects/colorize/search.php?q=coral https://alexbeals.com/projects/colorize/search.php?q=coral https://alexbeals.com/projects/colorize/search.php?q=goldenrod https://alexbeals.com/projects/colorize/search.php?q=goldenr... https://alexbeals.com/projects/colorize/search.php?q=eggplant https://alexbeals.com/projects/colorize/search.php?q=eggplan... I don't believe just switching from average to dominant color will actually fix this. (Edit: s/more often wrong than not/<diplomatic verbiage>/)
- dahart 6y agoWhat kind of result would you expect with the query "coral", which doesn't have a dominant color, or a correct answer?
- shagie 6y agohttps://en.wikipedia.org/wiki/Coral_(color) https://en.wikipedia.org/wiki/Coral_(color) I would contend that if the suggest color is more than X away from the traditionally named color (as defined in rgb.txt), then it needs to be reconsidered to see if its "right" or not.
- dahart 6y agoIn this case, it could be reasonably argued that the CSS/X11 definition of “coral” is just as wrong, and a quick image search provides all the proof we need. ;) This site is an image search query tool, not a CSS color reference. We knew that before querying. It would be reasonable, and a great idea even, to return multiple results, and include the CSS color if the query matches that name. But maybe I really do want to query for pictures of coral and not the CSS color names. The CSS “coral” was someone’s arbitrary choice, and not the only right answer. Don’t make the mistake of assuming that CSS color names should be considered the authority on color names- to the exclusion of any other use of the word - outside of HTML or X11 contexts, or even within those contexts.
- mod 6y agoI like this project. It's not accurate[1], but it's still very cool and I don't think there's a great way to make it better without ruining the fun and simplicity. [1] https://alexbeals.com/projects/colorize/search.php?q=piss https://alexbeals.com/projects/colorize/search.php?q=piss
- p1necone 6y agoI wonder if that specific bad result is due to safe search? Searching for Animals seems to be hit or miss too - e.g. I would expect 'Dolphin' or 'Shark' to return grey but of course all the images of them have blue ocean too and so you get a shade of blue instead.
- nerdponx 6y agoEh, some stuff is just off. https://alexbeals.com/projects/colorize/search.php?q=pink https://alexbeals.com/projects/colorize/search.php?q=pink
- netsec_burn 6y agoFuchsia too, but pink.. wow.
- mod 6y agoMaybe. I got some pretty accurate results in situations I would expect, like "beer." Piss, unlike dolphin (for reasons you note), I would expect to return pretty close to the correct color, but I didn't go check the google results.
- code_duck 6y agoResults are similarly inaccurate for other common fluids like milk, cream, oil, orange juice, or antifreeze.
- joshschreuder 6y agohttps://alexbeals.com/projects/colorize/search.php?q=Urine https://alexbeals.com/projects/colorize/search.php?q=Urine Is a bit better
- porphyra 6y agoInstead of returning the mean rgb values, a better idea is to cluster the colors (e.g. using mean-shift algorithm) in a perceptually uniform color space [2] (such as CIELAB). [1] https://en.wikipedia.org/wiki/Mean_shift https://en.wikipedia.org/wiki/Mean_shift [2] https://programmingdesignsystems.com/color/perceptually-uniform-color-spaces/ https://programmingdesignsystems.com/color/perceptually-unif...
- dqpb 6y agoYes, this would be much better. Additionally it could return a pallet of N colors instead of just one.
- Techonomicon 6y agoUsing a better algorithm makes sense, though a single color seems to be the point of the "product" in this case.
- davycro 6y agoNeat suggestion. I too am seeing shades of brown for most queries. Maybe this would help.
- dsamarin 6y agoI heartily agree. For example, searching kiwi should result in roughly the color of the inside part. Instead it's a light muted green, probably taking into account a white background that it's usually featured on. Taking the mode by clustering instead of the mean would improve results.
- mkasu 6y agoThere's a paper which does something similar including an analysis of different statistical models on top of a CIELAB color space. Estimating Color-Concept Associations from Image Statistics. Ragini Rathore et al., IEEE VIS InfoVis 2019. https://arxiv.org/pdf/1908.00220.pdf https://arxiv.org/pdf/1908.00220.pdf
- jansan 6y agoAgreed. A flower should not be represented by a brown color.
- mabbo 6y agoEntirely off topic, I know, but the title is one of the few words Canadian English spells uniquely. 'Colourize'. In British English: Colourise. American: Colorize. And we're very upset that spell checkers make us choose between only American and British options.
- rswail 6y agoAs an Aussie, I'm over it. OED says that -ize is equally "correct" to -ise. Australian spelling guidance has dropped the U in "color", "honor" etc. I keep the "e" in axe, I spell metric measures (and centre and theatre) with "-re" I still differentiate between advise and advice, practise and practice, defense and defence. And I'd spell "check" as "cheque" except no-one outside the US still uses those. /s
- joshschreuder 6y agoLicense and licence always throws me off. And I much prefer aging to ageing.
- mabbo 6y agoWait, are you saying that Australian English uses 'Colorise'?
- p1necone 6y agoI am reminded of this by some of the seemingly bad results: https://www.youtube.com/watch?v=wh4aWZRtTwU https://www.youtube.com/watch?v=wh4aWZRtTwU
- sodapopcan 6y agoNeat! It would be a nicer experience if search bar would autofocus.
- sombremesa 6y agoI wish this wouldn't take over my browser history like that.
- riebschlager 6y agoThis is really fun! I started plugging in US states. It makes a pretty interesting palette for the map. https://gist.github.com/riebschlager/2f1a3c0391bc42c9ec9bdc6e46e19ab7 https://gist.github.com/riebschlager/2f1a3c0391bc42c9ec9bdc6...
- Svetlitski 6y agoSearching for "pink" results in a muddy brown: https://alexbeals.com/projects/colorize/search.php?q=pink https://alexbeals.com/projects/colorize/search.php?q=pink
- alanbernstein 6y agoThis is neat, coincidentally I was wondering about a superficially similar problem recently: Given a list of arbitrary strings, generate a consistent mapping from that list to a color palette of distinguishable colors. This is distinct from deterministically mapping a single string to a single color (easy) because the intention is to provide a reasonably distinct set of colors, which I think can't be guaranteed when looking at single values. Bonus: if [str1, str2, str3] -> [rgb1, rgb2, rgb3], have the map update incrementally, so that [str1, str2, str3, str4] -> [rgb1, rgb2, rgb3, rgb4]. I assume I'm restating a version of some existing algorithm, but I don't know what.
- Biganon 6y agoFunnily enough, the word "BA0BAB" returns #B688AB, close to #BA0BAB but not exactly it
- mkasu 6y agoFor people who are interested in this kind of idea, there is some research on estimating Word-Color associations. A popular crowd-sourced dataset for this is [1] which contains average color association for 14,000 words. There is a demo available at [2]. There's also a recent work[3] trying to estimate such association using image data from Google, similar to the OP project, but a bit more sophisticated than just taking an average. 1: Colourful Language: Measuring Word-Colour Associations, Saif Mohammad, ACL 2011 Workshop on Cognitive Modeling and Computational Linguistics (CMCL). https://www.aclweb.org/anthology/W11-0611/ https://www.aclweb.org/anthology/W11-0611/ 2: http://www.lexichrome.com/ http://www.lexichrome.com/ 3: Estimating Color-Concept Associations from Image Statistics. Ragini Rathore et al., IEEE VIS InfoVis 2019. https://arxiv.org/pdf/1908.00220.pdf https://arxiv.org/pdf/1908.00220.pdf
- khiner 6y agoI had so much fun with this. I actually like that it uses the mean rather than some clustered mode in a lot of the cases I tried out. For example, “space” is pleasantly brighter than the dark black/blue hue that would come from that approach. It’s a little warmer and brighter than that, and feels like a truer representation of the concept in my mind’s eye. Obviously it will end up muddy for some things with several dominant colors. The mean approach also allows for some fun experiments like “black and white” which returned a rewardingly exact gray for me. Which led me to “newspaper” which is gray with most weight to the red and some to blue, and looks just right. I just spent about 15 minutes on this. Simple fun and useful, I am totally going to use this for something, thanks!
- winrid 6y agoAll the vehicle manufacturers I tried gave varying shades of "grey". Fire is also not what I expected :)
- antattack 6y agoHmm... Socialist: pinkish Communist: bright red Capitalist: light brown Fascist: dark brown
- winrid 6y agoYou could probably improve the accuracy a lot by ignoring some percentage of the edge of images, to help eliminate averaging the backgrounds.
- echelon 6y ago"Hacker News": https://alexbeals.com/projects/colorize/search.php?q=Hacker+news https://alexbeals.com/projects/colorize/search.php?q=Hacker+... Not bad!
- anonytrary 6y agoCool idea, but as expected, any word/phrase that isn't approximately one-to-one with a particular color or region in the color space turns up nearly gray.
- jhncls 6y agoThis reminds of Randall's xkcd colors[0], who did the reverse experiment: given a color, what would be the most appropriate name? The 954 names made it into Python's matplotlib. [0] https://blog.xkcd.com/2010/05/03/color-survey-results/ https://blog.xkcd.com/2010/05/03/color-survey-results/
- azinman2 6y ago"pink" seems to fail miserably.
- swyx 6y agoI like how the result text switches from white to black depending on the brightness of the selected background color. does anyone know how this is done? I could use this algorithm in other projects
- pmhpereira 6y agoIt's called Luminance Contrast: https://stackoverflow.com/a/36888120 https://stackoverflow.com/a/36888120
- swyx 6y agoty!
- neilsense 6y ago"indian" is... https://alexbeals.com/projects/colorize/search.php?q=indian https://alexbeals.com/projects/colorize/search.php?q=indian
- dan-robertson 6y agoFWIW, I tried some other words like American or German and mostly got shaded between pinkish grey and brown. European is a pale blue.
- majewsky 6y ago"Truth" gives me a nearly perfect 50% gray, which is kind of beautiful when you think about it.
- makach 6y agouh-oh https://alexbeals.com/projects/colorize/search.php?q=human https://alexbeals.com/projects/colorize/search.php?q=human https://alexbeals.com/projects/colorize/search.php?q=skin https://alexbeals.com/projects/colorize/search.php?q=skin this is crayola-gate all over....
- felixr 6y agohttps://alexbeals.com/projects/colorize/search.php?q=person https://alexbeals.com/projects/colorize/search.php?q=person https://alexbeals.com/projects/colorize/search.php?q=boy https://alexbeals.com/projects/colorize/search.php?q=boy https://alexbeals.com/projects/colorize/search.php?q=girl https://alexbeals.com/projects/colorize/search.php?q=girl
- adontz 6y agoColors of Python and C++ are more pleasant to me, than colors of C# and Java. Oh, that's why, I guess :-D
- monetus 6y agoNot that these do the same thing, but if you'd like, I wrote this proc in tcl/tk a couple of days ago if anyone wants to compare this site to tk's internals. proc color_name_to_hex {name} { set hex "#" foreach color [winfo rgb . "$name"] { append hex [string range [format %02x $color] 0 1] } return $hex }
- thecellardoor 6y agoThis is oddly addictive. Just typing in stuff and see what colors it gives me :)
- chris_st 6y agoIndeed -- I really like the color "blargh" :-)
- kemiller2002 6y agoIt's a neat idea, but the colors seem off. For example, I search for tomato and I get #DC9385 which is a light rust color(?). Maybe this is just what I think as the color tomato should be is different. I would think a vibrant red. I know tomatoes come in different colors, but to me that is the color that immediately jumps to mind. Cool idea though.
- indymike 6y agoI tried wine and cabernet and got a similar color to the bkg on this site. It did nail beer, though. Maybe not a wine lover?
- swyx 6y agodecidedly not yellow https://alexbeals.com/projects/colorize/search.php?q=yellow+submarine https://alexbeals.com/projects/colorize/search.php?q=yellow+...
- tux 6y agoCool project, but can you add API? I coded this basic python script to show colors in terminal; https://github.com/tuxys/python/blob/main/color.py https://github.com/tuxys/python/blob/main/color.py
- inull 6y agoJust for fun, I tried this :-) https://alexbeals.com/projects/colorize/search.php?q=Trump https://alexbeals.com/projects/colorize/search.php?q=Trump (#4F4252) https://alexbeals.com/projects/colorize/search.php?q=Biden https://alexbeals.com/projects/colorize/search.php?q=Biden (#433A4A) Colors looks very similar O_o Could this be a sign?