Page 1 of 1

Creating transparent Text

Posted: 2006-11-28T15:09:51-07:00
by monsters
Hi,

I want to set the opacity level of some text i'm placing on an image, and I can't figure any way to do it.

Here's the meat of my test harness , which works fine, but only does fully opaque text.

So the question, is what do i need to do to set the text say.. 50% opaque/transparent.. I currently use MagickEvaluateImage to set opacity on images for composite operations, but can't find anything that acts like that on a DrawingWand.

--
$source = NewMagickWand();
$drawing = NewDrawingWand();
$pixel = NewPixelWand();
PixelSetColor($pixel,"#ff0000");
DrawSetFillColor($drawing,$pixel);
DrawSetFont ( $drawing , " Arial " ) ;
DrawSetFontSize( $drawing,$fontsize);
DrawSetFontWeight($drawing,100);
MagickReadImage($source,'3.jpg');

MagickSetFormat($source, 'JPEG');

DrawAnnotation($drawing, $xLocation, $yLocation + $height , "test test");

MagickDrawImage($source, $drawing);

MagickWriteImage($source,'output.jpg');
--

Posted: 2006-11-28T15:55:29-07:00
by el_supremo
After PixelSetColor add a PixelSetOpacity - I think it will look like this:
PixelSetOpacity($pixel,"0.8");
for almost transparent text.

Pete

Fantastic

Posted: 2006-11-29T15:11:16-07:00
by monsters
That does the trick, pixelwand controls all colors and such, check.

If you have an answer for this one,
http://redux.imagemagick.org/discourse- ... php?t=7938

I'll buy you a nice seafood dinner.

Posted: 2006-11-29T16:48:51-07:00
by el_supremo
I saw your other post and tried it too. Haven't solved it yet but will probably post what I have.

Seafood? YUMMY :-)

Pete