http://qs1969.pair.com?node_id=11143944


in reply to Create image from pixel values with Imager

See RAW. raw_datachannels default is 3. Either set it to 4, or better to 1 but then pack with C*.

Replies are listed 'Best First'.
Re^2: Create image from pixel values with Imager
by Anonymous Monk on May 17, 2022 at 13:48 UTC
    Thank you so much, this works perfectly:
    my $img = Imager->new( type => 'raw', xsize => 256, ysize => 256, data => pack('C*', @data), raw_interleave => 0, raw_datachannels => 1, raw_storechannels => 1 ); $img->write(file=>'data.png');