Search code examples
imagemagickimage-manipulationgdtexturestext-rendering

Is it possible to "punch" textured text from an image, with GD or similar?


is it also possible to "punch" text from an image, so that I get a text-image with part of an image as texture, from the offset where I "punched"?

I know I can write text on an image with GD. I've read about being able to texture text with a smaller image to tile-fill text, but that's not what I am looking for.. Compare the below example, if my question still haven't made sense.

Example (via http://www.photoshopessentials.com/images/type/effects/texture-text/photoshop-textured-text.gif): textured text


Solution

  • Here are instructions for compositing.

    http://www.imagemagick.org/Usage/compose/#mask

    You need

    1. A black image (e.g. black-bg.png)
    2. The ripple image (e.g. ripple-overlay.png)
    3. The text image, with the text white on black (e.g. text-mask.png)

    All three should be the same size. Then,

    composite black-bg.png ripple-overlay.png text-mask.png final.png
    

    for #3, the mask can actually be grayscale, with the gray level controlling how much of each image is used.

    • Black -- use the pixel from the background
    • White -- use the pixel from the overlay image
    • Gray -- mix them based on the gray level (you might want this for anti-aliasing around the letters)