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?
possible bug .mpc format IM 6.7.3.1 Q16
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug .mpc format IM 6.7.3.1 Q16
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
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
Flatten composites the images onto a canvas of background color. Add -background none just before -flatten.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug .mpc format IM 6.7.3.1 Q16
Thanks. My mistake. I thought one could use a transparent background image. Sorry for the false alarm.