in reply to Re: Accessing the pen values of the pixels of a GIF?
in thread Accessing the pen values of the pixels of a GIF?
#! perl -slw use strict; use GD; my $img = GD::Image->new( $ARGV[0] ) or die $!; my %palette; my $total= 0; my( $x, $y ) = $img->getBounds; for my $yi ( 0 .. $y-1 ) { ++$palette{ $img->getPixel( $_, $yi ) } for 0 .. $x-1; } for my $i ( sort{ $a <=> $b } keys %palette ) { $total += $palette{ $i }; printf "index:%3d (%02x:%02x:%02x) n:%d\n", $i, $img->rgb( $i ), $palette{ $i }; } print( " $x * $y = ", $x*$y, " =?= $total\n");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Accessing the pen values of the pixels of a GIF?
by BrowserUk (Patriarch) on Nov 08, 2010 at 09:13 UTC |