zentara on wrote...
| On Fri, 31 Oct 2008 06:57:25 -0700
| "Min Yan" <[EMAIL PROTECTED]> wrote:
|
| #!/usr/bin/perl -w
| use strict;
| use Image::Magick;
|
| my $image = Image::Magick->new;
| $image->Set(size=>'170x100');
| my $rc = $image->Read("xc:white");
|
| $image->Draw(primitive=> 'line',fill=>'red', points=>'0,0 110,70');
| $image->Draw(primitive=> 'rectangle',fill=>'green', points=>'60,30 90,60');
| $image->Transparent('color' => 'green');
|
| # another way to do it transparency
| #$image->Mogrify('transparent-color' => 'green');
|
| $image->Write("output.png");
|
The commented out alturnative will not work for TWO reasons!!!
that setting is only applied to pallete image formats such as PNG8 or GIF
both of which it to define the underlying color used for boolean transparency
where one color is designated are 'representing' transparency. This is
no the case with PNG.
Even then only transparent areas are set to that 'transparent' color and
given the appropriate 'transparent color index' in the color pallette.
Any existing 'green' will be given a seperate color index to ensure it
remains opaque!!!!
That is the image will then have two 'green' colors a opaque one and one
representing transparency, which can then be used by web browsers or
other old image programs that do not understand transparency at all.
See IM Examples, GIF transparency for details
http://www.imagemagick.org/Usage/formats/#gif_trans
Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
"Computers in the future may weigh no more than 1.5 tons."
- Popular Mechanics, 1949
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users