I have an array of 65536 values from 0-254 that
makes an image after doing this:
open my $fh, '>', 'data';
binmode $fh;
print $fh pack 'C*', @data;
close $fh;
`convert -depth 8 -size 256x256+0 gray:data data.png`;
I'd like to use Imager instead but my output is
slightly scrambled:
my $img = Imager->new(
type => 'raw',
xsize => 256,
ysize => 256,
data => pack('L>*', @data),
raw_interleave => 0,
raw_storechannels => 1,
model => 'gray'
);
$img->write(file=>'data.png');
What am I doing wrong? Thank you!