GD will do that for you:
#! perl -slw use strict; use GD; my $img = GD::Image->new( $ARGV[ 0 ] ) or die $!; my $colors = $img->colorsTotal or die "$ARGV[ 0] is a truecolor image (no palette)"; for ( 0 .. $colors ) { printf "%5d: R:%2x G:%2x B:%2x\n", $_, $img->rgb( $_ ); }
In reply to Re: Reading an image palette
by BrowserUk
in thread Reading an image palette
by leocharre
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |