Search code examples
photoshoppalette

Getting colour palette from a photoshop file


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!


Solution

  • 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:

    enter image description here

    and do this:

    convert image.psd -flatten -unique-colors palette.png
    

    I get this (I have enlarged it 5000% so you can see it):

    enter image description here

    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