1use warnings; 2use strict; 3use FindBin '$Bin'; 4use Image::PNG::Libpng; 5use Test::More tests => 3; 6 7my $file_name = "$Bin/tantei-san.png"; 8my $png = Image::PNG::Libpng::create_read_struct (); 9open my $file, "<:raw", $file_name or die $!; 10Image::PNG::Libpng::init_io ($png, $file); 11#print "Reading PNG.\n"; 12Image::PNG::Libpng::read_png ($png); 13#print "Getting rows.\n"; 14my $colors = Image::PNG::Libpng::get_PLTE ($png); 15#exit; 16# for my $i (0..$#$colors) { 17# my $color = $colors->[$i]; 18# print "$i: Red: $color->{red} green: $color->{green} blue: $color->{blue}\n"; 19# } 20ok ($colors->[10]->{red} == 10); 21ok ($colors->[20]->{green} == 20); 22ok ($colors->[100]->{blue} == 100); 23close $file or die $!; 24 25# Local Variables: 26# mode: perl 27# End: 28