Thanks, that is what I was looking for, last night: pass Imager a data array or pack'ed binary data. I could not hit that in any doc (with my limited bandwidth). And even now Imager::Draw manages to confuse me more than clear it up.
Is the following equivalent without the functionality of switching the channels (I can create data with any channel arrangement)? Note how I had to change ROSYBROWN to RGBA and that non-transparent seems to be 0xFF!
use strict;
use warnings;
use Imager;
use constant IMAGESIZE => 300;
# RBGA
use constant ROSYBROWN => 0xBC8F8FFF;
my @result = map { # make us some picture to find when
( ROSYBROWN ) x $_, # examining output, let it be random
int( rand 0xFFFFFFFF ), # colour diagonal on uniform BG
( ROSYBROWN ) x ( IMAGESIZE - $_ - 1 ),
} 0 .. IMAGESIZE - 1;
my $img = Imager-> new(
type => 'raw',
xsize => IMAGESIZE,
ysize => IMAGESIZE,
data => pack( 'L>*', @result ),
raw_interleave => 0,
raw_datachannels => 4,
raw_storechannels => 4,
);
$img->write(file=>'out.png');