in reply to Re: Creating transparent images using Imager
in thread Creating transparent images using Imager

Thanks... if you know how, could you perhaps express "draw the bitmaps into separate Imager canvasses and then overlay" as a few lines of Perl?
  • Comment on Re^2: Creating transparent images using Imager

Replies are listed 'Best First'.
Re^3: Creating transparent images using Imager
by Anonymous Monk on Apr 27, 2009 at 19:11 UTC
    I've never used Imager before :) This seems to work
    #!/usr/bin/perl -- use strict; use warnings; use Imager; # setting Imager::Color->new($red, $green, $blue, $alpha); my $blue = Imager::Color->new( 0, 0, 255, 255); my $red = Imager::Color->new( 255, 0, 0, 63); my $canvas_blue = Imager->new(xsize=>700, ysize => 500, channels => 4) +; $canvas_blue->box(color => $blue, xmin=>10, ymin=>30, xmax=>200, ymax= +>300, filled=> 1); my $canvas_red = Imager->new(xsize=>700, ysize => 500, channels => 4); $canvas_red->box(color => $red, xmin=>50, ymin=>80, xmax=>250, ymax=>3 +50, filled=> 1, alpha => 1); my $outfile = "foo.png"; # overlay $canvas_blue->rubthrough( src => $canvas_red ); $canvas_blue->write(file=>$outfile) or die $canvas_blue->errstr;
    canvas, overlay, alpha, Imager::Transformations
      That is just what I am looking for. Thanks very much.