Using the help here I found this command to convert a png to a gif and still have it look halfway decent:
convert source.png -background #FFFFFF -flatten -fuzz 10% -transparent #FFFFFF target.gif
Now I want to convert a whole mess of png's with mogrify instead like this:
mogrify -format gif -background #FFFFFF -flatten -fuzz 10% -transparent #FFFFFF *.png
It doesn't produce the same result. In the convert case I get an image with transparency and a ring of background color in the semi-transparent pixels. In the mogrify case there is no transparency.
I'm using:
Version: ImageMagick 6.5.3-8 2009-06-16 Q8 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Mogrify and convert not working how I think they should
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Mogrify and convert not working how I think they should
this came up in another forum recently and the response was:
If so you might also try:
convert image.png -channel a -threshold XX% -channel rgba image.gif
and if that works, then try it in mogrify
but your command is a bit strange for just a conversion.Anthony wrote:Sorry -flatten is not usable from mogrify...
use
-bordercolor white -border 0
instead
Can you clarify why you flatten transparency only to put it back again? Are you doing this because PNG allows 8-bit transparency and GIF only allows 1-bit (binary) transparency?convert source.png -background #FFFFFF -flatten -fuzz 10% -transparent #FFFFFF target.gif
If so you might also try:
convert image.png -channel a -threshold XX% -channel rgba image.gif
and if that works, then try it in mogrify
Re: Mogrify and convert not working how I think they should
I found the command line in the ImageMagick help here:
http://www.imagemagick.org/Usage/formats/#bg_pattern
The reason for all this is what you suspected which is the 1 bit alpha problem of gifs. I'm stuck needing to use gifs, but I still want some transparency. I realized that my initial convert command line doesn't work either. If the icon has white in it my convert command makes it transparent too. I'll give your alpha idea a try.
Thanks for the help.
http://www.imagemagick.org/Usage/formats/#bg_pattern
The reason for all this is what you suspected which is the 1 bit alpha problem of gifs. I'm stuck needing to use gifs, but I still want some transparency. I realized that my initial convert command line doesn't work either. If the icon has white in it my convert command makes it transparent too. I'll give your alpha idea a try.
Thanks for the help.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Mogrify and convert not working how I think they should
-flatten is fine with convert, but apparently not usable with mogrify, thus the work around I mentioned that came from Anthony on another post elsewhere.I found the command line in the ImageMagick help here:
http://www.imagemagick.org/Usage/formats/#bg_pattern