Page 1 of 1

Overlapping Photos doesn't work

Posted: 2010-12-02T13:33:02-07:00
by TanEsal
Hi

Could you advice what's wrong. I want to overlap photos and used example from http://www.imagemagick.org/Usage/photos/#overlap

Code: Select all

//Mask
exec("/usr/local/bin/convert -size 90x80 xc:white xc:black -size 90x40 gradient: +swap -append -rotate 90 overlap_mask.png");

//Overlaped  
exec("/usr/local/bin/convert holocaust_tn.gif -extent 200x90 spiral_stairs_tn.gif overlap_mask.png -gravity East -composite overlap_photos.jpg");
Here is a result which don't have transparensy but I don't know why:
Image

Created mask:
Image

It is a GoDaddy hosting, may be it will add something useful.

Re: Overlapping Photos doesn't work

Posted: 2010-12-02T13:55:04-07:00
by fmw42
Godaddy hosting is at 6.2.7 for IM. It is extremely old (over 350 versions old). That is probably the problem. Unfortunately, I have asked several times, but could not get Godaddy to upgrade its version of IM. So possibly one of the options you are using in your commands was not implemented or buggy at that old version. Most likely -extent. See http://www.imagemagick.org/Usage/crop/#extent Or possibly something with -composite.

Re: Overlapping Photos doesn't work

Posted: 2010-12-02T17:30:11-07:00
by anthony
The -extent seemed to work fine.

What looks like happened is that the overlay image was modified by the mask rather than the mask being used to mix images.

Before IM v6.3.4-11 composite masking erroniously used the mask as a 'transparency' mask for the source image rather than a selection or mixing mask between the results and the original image.
See Composite Mask Bug
http://www.imagemagick.org/Usage/bugs/composite_mask/

As the images do not contain transparency the solution is simple. Extend the background image eastward (as it is now doing), but also extend the overlay image westward. Then ensure ALL images have an alpha channel (-matte) before doing the masked overlay.

Alternately, mask the overlay image with the appropriate transparency, then overlay!
That will however mean the mask has to be adjusted to match the overlay image.

I do not recommend simply adding an alpha channel and resizing the mask so as to match the overlay image, though for that version of IM it will work. The problem is that will break when IM is finally updated.