Dave Watt
Dave Watt

Reputation: 195

Imagick PHP - Replacing solid color area with an image fill?

I'm new to Imagemagick and PHP imagick. I've been searching for days for a function or method that will allow me to replace a solid color or transparent area in one image with the contents of another image.

For example:

Image #1 is a pre-made picture of a person with the face area removed and filled with solid white (#FFFFFF).

Image #2 is a transparent PNG of a face, where the face is has been cut-out and the background is transparent.

I want to merge these two images together and fill the solid white area of image #1 with the face on image #2.

Is this possible with imagick? I haven't found any information on google about this, but I've come close with masking functions and composite functions.

Upvotes: 0

Views: 1579

Answers (1)

Sudip
Sudip

Reputation: 2051

Yes, it is possible using ImageMagick. It is called "Composite", overlapping one image to another. For more details goto script example

Upvotes: 0

Related Questions