Mobile app version of vmapp.org
Login or Join
Vandalay110

: Generate Color Palette from Image? I want to generate a color palette from an image. It's a long, drawn out, tedious process because I have to copy each of the 16-32 colors per image and

@Vandalay110

Posted in: #Color #Images #Palette #SoftwareRecommendation

I want to generate a color palette from an image. It's a long, drawn out, tedious process because I have to copy each of the 16-32 colors per image and paste them, making sure I don't forget them which I probably will and have to go back to the image looking for it to put it in my palette image.

I looked online to see if there were any image palette generators, there were, but they don't generate a palette from an image, they try and give you a "similar palette" or something weird like that. I want to generate an image with every single color from the image in a row, like so:

(This is my manually generated palette):


Something like that, but preferably at 1px height. So-called "palette generators" keep giving me stuff like this for some reason:



What tool(s) can I use to generate an image out of every single color of another image, in a row, like the first picture?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Vandalay110

1 Comments

Sorted by latest first Latest Oldest Best

 

@Cofer715

You can do it with ImageMagick (shown here under Bash):

magick goHGJ.png -depth 8 txt:- | sed -e "1d;s/.* #/#/;s/ .*//" | sort -u


This converts the image to "txt" format, then uses a "sed" script to extract the hex-values for the colors, then "sort -u" to remove duplicates. Here's the result for your test image:
#209020FF #282830FF #30C830FF
#403078FF
#505060FF
#5840A0FF
#8050D8FF
#888898FF
#A02000FF
#B090F0FF
#B8B8C8FF
#D03800FF
#E06810FF
#F0B020FF


This is about the same procedure that you hinted at, except it's all done automatically for you without the manual cut-and-paste stuff.

The final "FF" on each entry is the alpha value (fully opaque). For your purposes you can ignore it.

Note that this will give you as many entries as you have colors in your image, so if you start with a photo the list is likely to be pretty long. In such a case you could use the ImageMagick "-colors N" option to reduce the number of colors to some limit, N.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme