Page 1 of 1

possible bug .mpc format IM 6.7.3.1 Q16

Posted: 2011-10-13T17:52:17-07:00
by fmw42
Version: ImageMagick 6.7.3-1 2011-10-13 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features:

Mac OSX Tiger:

The following should make an image that is transparent wherever not white and gray(1) where the image was white.

The following works:

convert logo: logo.mpc
color="white"
convert -background none \
\( logo.mpc +transparent "$color" -fill "gray(1,1)" -opaque "$color" \) \
-flatten test.mpc
display test.mpc

Histogram:
50956: ( 0, 0, 0, 0) #00000000 none
256244: ( 1, 1, 1,255) #010101 rgba(1,1,1,1)



But the following fails and I get a black and white image:

convert logo: logo.mpc
convert logo.mpc -matte -channel A -evaluate set 0 logo_trans.mpc
color="white"
convert logo_trans.mpc \
\( logo.mpc +transparent "$color" -fill "gray(1,1)" -opaque "$color" \) \
-flatten test.mpc
display test.mpc

Histogram:
256244: ( 1, 1, 1,255) #010101 rgba(1,1,1,1)
50956: (255,255,255,255) #FFFFFF white


Is this a bug or am I misunderstanding something here?

Re: possible bug .mpc format IM 6.7.3.1 Q16

Posted: 2011-10-14T13:09:22-07:00
by fmw42
Further investigation seems to find that it appears to be a -flatten issue vs -composite

This does not work:

convert logo: logo.mpc
convert logo.miff -matte -channel A -evaluate set 0 logo_trans.mpc
color="white"
convert logo_trans.mpc \
\( logo.mpc +transparent "$color" -fill "gray(1,1)" -opaque "$color" \) \
-flatten test.mpc
display test.mpc


Nor does this:

convert logo: logo.mpc
convert logo.miff -matte -channel A -evaluate set 0 logo_trans.mpc
color="white"
convert logo_trans.mpc \
\( logo.mpc +transparent "$color" -fill "gray(1,1)" -opaque "$color" \) \
-compose over -flatten test.mpc
display test.mpc


But this works:

convert logo: logo.mpc
convert logo.miff -matte -channel A -evaluate set 0 logo_trans.mpc
color="white"
convert logo_trans.mpc \
\( logo.mpc +transparent "$color" -fill "gray(1,1)" -opaque "$color" \) \
-compose over -composite test.mpc
display test.mpc

Re: possible bug .mpc format IM 6.7.3.1 Q16

Posted: 2011-10-15T08:55:13-07:00
by magick
Flatten composites the images onto a canvas of background color. Add -background none just before -flatten.

Re: possible bug .mpc format IM 6.7.3.1 Q16

Posted: 2011-10-15T09:12:05-07:00
by fmw42
Thanks. My mistake. :oops: I thought one could use a transparent background image. Sorry for the false alarm.