Results 1 to 5 of 5

Thread: Tool to extract palette / color table from image

  1. #1
    Join Date
    Jul 2008

    Tool to extract palette / color table from image

    I'm looking for a tool that takes as an input an image (gif preferrably) and returns in some format the colors used in that image.
    I want to take and image and extract the palette so that I can make a mosaic out of it in real life and therefore need to know the colors. However, I'm having trouble finding just such a tool.
    Is there all ready a tool out there?
    GUI or CLI (preferred)????

  2. #2
    Join Date
    Dec 2008
    43° 7' 41" 131° 54' 3"

    Re: Tool to extract palette / color table from image

    Open your image in the Gimp there is a filter found in the image window menu under Colors → Info → Smooth Palette. Maybe not what you want but its the first thing to come to mind
    Boot Info Script: How to
    The post above and the post below suffer from the Rashomon effect!

  3. #3
    Join Date
    Apr 2006
    Lubuntu 12.04 Precise Pangolin

    Re: Tool to extract palette / color table from image

    The CLI tool to use is ImageMagick.
    You can use the convert command to generate a histogram of the image:
    convert image_file.gif -format %c -depth 8  histogram:info:-
    or you could convert a image into a simpler color table image:
    convert image_file.gif -unique-colors -scale 1000%  color_table.gif
    Read more about ImageMagick usage here

  4. #4
    Join Date
    Jul 2008

    Re: Tool to extract palette / color table from image

    Awesome! Your color_table example is pretty much exactly what I am looking for.
    I figured ImageMagick could do it I just couldn't find the way to do it.

    Also using 'identify -verbose file.extension' will print out the color map. But, it only works for gifs.

  5. #5
    Join Date
    Apr 2012

    Re: Tool to extract palette / color table from image

    Although this problem has already been solved, here is another way of extracting colors from any image that uses 256 colors or less with GIMP:

    1. Image-->Mode-->Indexed;
    2. select "Generate optimum palette";
    3. set "Maximum number of colors" to 256;
    4. click "Convert";
    5. Windows-->Dockable Dialogs-->Palettes;
    6. right-click empty space inside tab (you should see a list of colored rectangles with writing next to them in the Palettes Dialog; right-click something white next to the writing);
    7. select "Import Palette";
    8. select "Image";
    9. finally, click "Import".

    You should see somewhere in the Palettes Dialog a rectangle containing all of the colors in your image, named after your image. For example, if your image was named "image.xcf", then "image.xcf" will be written next to your palette. There will also be a number in brackets next to the name, indicating the number of colors in your palette.

    Read more about GIMP usage here

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts