sub palette_rgb_gd { my $abs_path = _abs_path($_[0]) or return; my @colors; require GD; my $img = GD::Image->new( $abs_path ) or die $!; my $colors = $img->colorsTotal or carp("$abs_path is a truecolor image (no palette)?"); for ( 0 .. $colors ) { my $rgb = sprintf '%02x%02x%02x', $img->rgb( $_ ); #debug( $rgb); #printf "%5d: R:%2x G:%2x B:%2x\n", $_, $img->rgb( $_ ); push @colors , $rgb; } return @colors; }