Fill text with a pattern from an external image

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Fill text with a pattern from an external image

Post by mkoppanen »

Is there any way i can fill te text with a pattern from an external image?
Mikko Koppanen
My blog: http://valokuva.org
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Fill text with a pattern from an external image

Post by magick »

You can generate patterns with DrawPushPattern(), DrawPopPattern(), and DrawSetFillPatternURL(). However, we will add a new method for setting the fill pattern and then rendering the pattern with the MagickAnnotateImage() method. We will try to get a patch in by the next release of ImageMagick.
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: Fill text with a pattern from an external image

Post by mkoppanen »

Thank you!
Mikko Koppanen
My blog: http://valokuva.org
web_artist

Re: Fill text with a pattern from an external image

Post by web_artist »

Is this "solved" ? ... how can I add a pattern to a certain text ?

Thanks :-)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Fill text with a pattern from an external image

Post by magick »

Try DrawSetFillPatternURL() and use a file:// URL to define the drawing pattern.
web_artist

Re: Fill text with a pattern from an external image

Post by web_artist »

I did that, but with no success.
Any thoughts ? :?

<?php
$im = new Imagick();
$im->newImage(200, 200, "#FFFFFF", "png");


$draw = new ImagickDraw();
$draw->rectangle( 0, 0, 200, 200 );
$draw->setFillPatternURL("/home/www/images/wood.jpg");
$im->drawImage($draw);


header( "Content-Type: image/png" );
echo $im;

?>
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: Fill text with a pattern from an external image

Post by mkoppanen »

Does not seem to be working here either (ImageMagick 6.4.0)
Mikko Koppanen
My blog: http://valokuva.org
Post Reply