Use ImagickDraw to create a "draw" object (it's like a layer), then add it over your image. Here's an example:
// create canvas
$draw = new ImagickDraw();
$draw->setfont('/path/to/your/font.ttf');
// load your overlay image
$overlay = new Imagick('/path/to/your/pattern.png');
// define pattern
$draw->pushPattern('myOverlay', 0, 0,
$overlay->getImageWidth(), $overlay->getImageHeight());
// fill canvas with the pattern (tile)
$draw->composite(Imagick::COMPOSITE_COPY, 0, 0,
$overlay->getImageWidth(), $overlay->getImageHeight(), $overlay);
// destroy pattern
$draw->popPattern();
$draw->setFillPatternURL('#myOverlay');
// put text
$draw->setFontSize(100);
$draw->annotation(0, 0, 'My TextImage');
// create your image (800x400)
$output = new Imagick();
$output->newimage(800, 400, 'transparent');
// this will center your canvas
$output->setGravity(Imagick::GRAVITY_CENTER);
// render canvas on this image
$output->drawImage($draw);
$output->setImageFormat('png');
header('Content-Type: image/png');
print $output;
If you want the overlay to be stretched to fit 800x600, then use that size instead of the pattern size when compositing
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…