use strict; use warnings; use feature 'say'; use Imager; use Image::PNG::Rewriter; my $i = Imager-> new( # defaults are RGB, 8 bits per channel xsize => 256, ysize => 2, filetype => 'raw', interleave => 1, # RRRR...GGGG...BBBB... data => \( pack 'C*', ( 0 .. 255 ) x 3, # 1st scanline is gradient ( 0 ) x ( 3 * 256 )), # 2nd scanline is flat black ) or die; $i-> write( data => \my $png, type => 'png' ); open my $fh, '<', \$png; my $re = Image::PNG::Rewriter-> new( handle => $fh ); say for $re-> original_filters; __END__ 1 0