I'm trying to extract the full palette table of an image using an 8-bit color depth. I have tried variations involving "-unique-colors" and "histogram:info:-", but both of these options reorder the color table and ignore duplicate colors in the table.
My ultimate goal is to create a color palette swatch in the shape of a 16x16 grid like in this mockup: http://www.thealmightyguru.com/Imagemag ... xample.png
I'm using Imagemagick 7 through a Windows 7 command line. Any help would be appreciated!
Export the palette of an 8-bit color image to an image.
-
- Posts: 4
- Joined: 2017-08-14T11:27:10-07:00
- Authentication code: 1151
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Export the palette of an 8-bit color image to an image.
The only method I know is "identify -verbose" and process the text. I show a Windows BAT script for this at http://im.snibgo.com/ckbkClut.htm#getColormap.bat
snibgo's IM pages: im.snibgo.com
-
- Posts: 4
- Joined: 2017-08-14T11:27:10-07:00
- Authentication code: 1151
Re: Export the palette of an 8-bit color image to an image.
I had to make some minor changes to have it work with the magick command of IM 7, but it did what I wanted it to do. I'll work at altering the output into the 16x16 image that I want.
Thanks for the reply snibgo. I have come across your site numerous times in the past looking for complex use of Imagemagick, and it's really impressive!
Thanks for the reply snibgo. I have come across your site numerous times in the past looking for complex use of Imagemagick, and it's really impressive!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Export the palette of an 8-bit color image to an image.
The script makes an image 256x1 pixels. Changing the script to directly make a 16x16 image is possible but tricky. Converting a 256x1 to 16x16 is easy:
I've also scaled to make the pixels more visible.
Code: Select all
magick in.png -crop 16x1@ -append +repage -scale 1000% out.png
snibgo's IM pages: im.snibgo.com