1

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): manual palette

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

enter image description here

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?

2
  • In my opinion the easier and faster way to do this is using this site: color.adobe.com/create/image
    – Gianmarco
    Jul 11, 2018 at 9:48
  • @Gianmarco: That doesn't create a palette with all the colors from the image; instead it creates one with just 5 colors based on a theme.
    – Luciano
    Jul 11, 2018 at 15:48

2 Answers 2

2

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.

2
  • Why is (or is it not?) -depth 8 needed? Dec 23, 2016 at 21:51
  • I added the -depth 8 option in case the input has 16-bit precision which would yield colors with 16 bits per component, like #F0F0B0B02020FFFF Dec 23, 2016 at 21:57
0

ColorFavs, Pictaculous, and ColorKitty all generate a color palette from an image. They might not give you exactly what you want, but they might be helpful to future people viewing this question.

For a more full list of color palette generators, see this post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.