Composite with mask gives unexpected results when saving to

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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Composite with mask gives unexpected results when saving to

Post by anthony »

Masking is working, though I have already reported one bug to do with transparency.
See Bug Testing
http://www.imagemagick.org/Usage/bugs/testing/

This is your main problem, BUT you also have quite a few other operational faults as you have not read the 'Basics' in IM Examples...

You should read your images BEFORE modifing them, and set options for operators BEFORE using those operators eg -fuzz and -trim shoudl be swapped, and image read before them!

Also you can NOT add transparency to a image (JPG) unless you add a matte channel!
the only exception that is guranteed for this is -compose CopyOpacity

Okay lets for the fixed up your preparations...

Code: Select all

convert http://www.pepsico.com/includes/images/Btn_PepsicoLogo.gif \
     -fuzz 5% -trim -write 1.jpg   +matte -negate -threshold 8000  1.gif
convert 1.jpg +matte -fill none -draw 'matte 0,0 reset' 1.png
now lets mask it...

Code: Select all

composite 1.jpg  1.png  1.gif    2.gif
Of course I can say it is probably the bug I previously reported, and is currently being fixed.

However just applying the mask directly to the image does work fine.

Code: Select all

convert 1.jpg 1.gif +matte -compose copyopacity -composite 3.gif
See IM Examples, Channels and Transparency
http://www.imagemagick.org/Usage/channels/#erase
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply