Page 1 of 1

Re: Composite with mask gives unexpected results when saving to

Posted: 2007-03-12T19:22:23-07:00
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