Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Creating transparent images using Imager

by hilitai (Monk)
on Apr 27, 2009 at 14:50 UTC ( [id://760360]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://760360]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 06:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found