Image-Pngslimmer

 view release on metacpan or  search on metacpan

t/02-slimnoncrit.t  view on Meta::CPAN


use strict;
use Image::Pngslimmer();

use Test::More tests =>1;

my ($pngfile, $blob1, $blob2, $read, $lengthfat, $lengthslim, $weightloss);


sysopen($pngfile, "./t/test1.png", 0x0);
$read = (stat ($pngfile))[7];
(sysread($pngfile, $blob1, $read) == $read) or die "Could not open PNG\n";
$blob2 = Image::Pngslimmer::discard_noncritical($blob1);
$lengthfat = length($blob1);
$lengthslim = length($blob2);
$weightloss = $lengthfat - $lengthslim;
print "Fat file was $lengthfat bytes long, slimmed file was $lengthslim bytes, saving $weightloss bytes\n";
ok($weightloss > 0);

close($pngfile);



( run in 2.365 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )