[SOLVED] composite with mask ignores mask on Mac

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
smotesko
Posts: 2
Joined: 2017-09-20T03:58:30-07:00
Authentication code: 1151

[SOLVED] composite with mask ignores mask on Mac

Post by smotesko »

Hello

I'm using composite with a B/W mask to compose two images.
On Mac I've got version 7.0.7-1 Q16 x86_64 2017-09-10. On Linux 6.7.7-10 2017-07-31 Q16.
First I've discovered it doesn't work as described in documentation on Mac, then I've checked on Linux and there it works fine.

Code: Select all

composite righthalf.jpg lefthalf.jpg mask.gif Mac.jpg
composite righthalf.jpg lefthalf.jpg mask.gif Linux.jpg
Here are all the image files mentioned:
  • righthalf.jpg
    Image
  • lefthalf.jpg
    Image
  • mask.gif
    Image
  • Mac.jpg
    Image
  • Linux.jpg
    Image
Last edited by smotesko on 2017-09-20T12:31:15-07:00, edited 1 time in total.
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: composite with mask ignores mask on Mac

Post by GeeMack »

smotesko wrote: 2017-09-20T04:13:00-07:00First I've discovered it doesn't work as described in documentation on Mac, then I've checked on Linux and there it works fine.

Code: Select all

composite righthalf.jpg lefthalf.jpg mask.gif Mac.jpg
composite righthalf.jpg lefthalf.jpg mask.gif Linux.jpg
The alpha handling has changed between v6 and v7. Try adding "-alpha set" after "composite".

Code: Select all

composite -alpha set righthalf.jpg lefthalf.jpg mask.gif Mac.jpg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: composite with mask ignores mask on Mac

Post by fmw42 »

I would suggest you start using the convert .... -composite syntax rather than composite. Composite is very old syntax and very limited compared to convert. See the difference in syntax at http://www.imagemagick.org/Usage/compose/#compose. The first two input images are swapped in convert syntax. So

Code: Select all

convert lefthalf.jpg righthalf.jpg mask.gif -composite Mac.jpg
Also in IM 7, you must add magick before composite. So it would be

Code: Select all

magick composite righthalf.jpg lefthalf.jpg mask.gif Mac.jpg
smotesko
Posts: 2
Joined: 2017-09-20T03:58:30-07:00
Authentication code: 1151

Re: composite with mask ignores mask on Mac

Post by smotesko »

GeeMack wrote: 2017-09-20T07:08:04-07:00 The alpha handling has changed between v6 and v7. Try adding "-alpha set" after "composite".

Code: Select all

composite -alpha set righthalf.jpg lefthalf.jpg mask.gif Mac.jpg
fmw42 wrote: 2017-09-20T09:07:24-07:00 I would suggest you start using the convert .... -composite syntax rather than composite. Composite is very old syntax and very limited compared to convert. See the difference in syntax at http://www.imagemagick.org/Usage/compose/#compose. The first two input images are swapped in convert syntax. So

Code: Select all

convert lefthalf.jpg righthalf.jpg mask.gif -composite Mac.jpg
Thanks! Both these solutions fixed my problem in v.7
I'm going to use `convert -composite` from now on.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: [SOLVED] composite with mask ignores mask on Mac

Post by fmw42 »

For IM 7 change convert to magick. Do not use magick convert or convert.
Post Reply