I have a photoshop file with several layers (all shapes, no bitmaps). Is there any automatic way I could extract the colours from all these shapes into a palette? Any advice would be great!
Without knowing your source image, I can’t say for sure, but as far as I know, the only real palette exists with bitmap images of indexed color.
So you’d change your color mode to “indexed”, giving you a 256 color palette ready for export.
Depending on your use case that may already be enough – you can also try to export a file with as few colors as possible (saving a GIF), giving you the opportunity to filter down on the most used colors in your image.
You can do that from the commandline with ImageMagick if you want to. It is installed on most Linux distros and available for Mac OSX and Windows.
So, if I start with this Photoshop file:
and do this:
convert image.psd -flatten -unique-colors palette.png
I get this (I have enlarged it 5000% so you can see it):
Or, if you want it as text:
convert image.psd -flatten -unique-colors txt:
# ImageMagick pixel enumeration: 5,1,255,srgb
0,0: (0,0,0) #000000 black
1,0: (255,0,0) #FF0000 red
2,0: (0,255,0) #00FF00 lime
3,0: (0,0,255) #0000FF blue
4,0: (255,255,255) #FFFFFF white
Click here to cancel reply.