Page 1 of 1

Combine overlap of two images

Posted: 2019-07-15T19:37:00-07:00
by TSchein
I'm trying to figure out how to combine two images, such that one of the images only appears where there is non-transparency in the other image. OK, that wasn't very clear. I'll explain with pictures. Consider these two images. In the second image, the gray area represents transparency.

Image Image

I want to combine them so that the circle is filled with content from the first image. So the result should look like this:

Image

Is there a way to do that?

Re: Combine overlap of two images

Posted: 2019-07-15T21:08:41-07:00
by 246246
If the gray area is your 2nd image is transparent,

Code: Select all

magick 1st.png 2nd.png -compose copy_opacity -composite result.png
will do the job.

Re: Combine overlap of two images

Posted: 2019-07-15T21:45:45-07:00
by TSchein
That's it! Thanks!