in reply to Re^2: Creating transparent images using Imager
in thread Creating transparent images using Imager
canvas, overlay, alpha, Imager::Transformations#!/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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Creating transparent images using Imager
by hilitai (Monk) on Apr 28, 2009 at 00:34 UTC |