gri6507 has asked for the wisdom of the Perl Monks concerning the following question:

Thanks for everyone's help on my previous Image::Magic related question. However, now that I got the fonts resolved, I am now having difficulties with creating a semi-transparent background in which I could draw my text. I have search here but did not find the answer. Similarly, the available documentation is not very helpful. My code so far is this

use strict; use Image::Magick; my ($image, $x); $image = Image::Magick->new; $x = $image->Set(size=>'100x100'); warn "$x" if $x; $x = $image->ReadImage('xc:none'); warn "$x" if $x; $x = $image->Draw(primitive=>'rectangle', points=>'5,5,50,25', fill=>' +white'); warn "$x" if $x; #$image->MatteFloodfill(x=>6, y=>6, matte => 90); <== gives 'Unrecogn +ized option (matte)' error $x = $image->Annotate(font=>'/usr/share/fonts/bitstream/Vera.ttf', fil +l=>'#00FF00', pointsize=>12, x=>10, y=>20, text=>'Hi'); warn "$x" if +$x; $x = $image->Write('x.png'); warn "$x" if $x; undef $image;
What I now want is to figure out a way to make the rectangle semi-transparent. Please help.

Replies are listed 'Best First'.
Re: Another Image::Magick question
by GrandFather (Saint) on Oct 10, 2005 at 21:00 UTC

    Depending on what you are truing to achieve, you may find this helpfull. It draws translucent text over an image using $image->Composite (compose=>'Hardlight', ...); to do the work of combining two images.


    Perl is Huffman encoded by design.