Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have an array of 65536 values from 0-254 that
makes an image after doing this:
I'd like to use Imager instead but my output is slightly scrambled:open my $fh, '>', 'data'; binmode $fh; print $fh pack 'C*', @data; close $fh; `convert -depth 8 -size 256x256+0 gray:data data.png`;
What am I doing wrong? Thank you!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');
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Create image from pixel values with Imager
by Discipulus (Canon) on May 17, 2022 at 07:27 UTC | |
by Anonymous Monk on May 17, 2022 at 07:40 UTC | |
by kcott (Archbishop) on May 17, 2022 at 08:25 UTC | |
by Anonymous Monk on May 17, 2022 at 12:39 UTC | |
by Anonymous Monk on May 17, 2022 at 13:24 UTC | |
Re: Create image from pixel values with Imager
by Anonymous Monk on May 17, 2022 at 13:12 UTC | |
by Anonymous Monk on May 17, 2022 at 13:48 UTC | |
Re: Create image from pixel values with Imager
by bliako (Monsignor) on May 17, 2022 at 14:08 UTC | |
Re: Create image from pixel values with Imager
by tonyc (Pilgrim) on Jun 07, 2022 at 12:05 UTC |
Back to
Seekers of Perl Wisdom