# untested my $im = Imager->new(xsize=>$width, ysize=>$height); my $per_line = $width * 4; # adjust the data to the format setscanline() takes $nfr =~ s/(.)(.)(.)/$3$2$1\xFF/gs; # paint it for my $y (0..$height-1) { $im->setscanline(y=>$y, pixels => substr($nfr, $y * per_line, $per_line)); }