Creating transparent Text
Posted: 2006-11-28T15:09:51-07:00
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');
--
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');
--