Error with convert and -transparent option

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
crashandburn4
Posts: 4
Joined: 2013-01-04T07:34:22-07:00
Authentication code: 6789

Error with convert and -transparent option

Post by crashandburn4 »

Hi guys, I'm pretty sure this is a bug since I've been using imagemagick to convert a few hundred files with some bash scripts for the last hour or so with no problem (and utilising the same command)).
The command that I use hasn't changed from my previous working command and is basically:

convert rauch0000.bmp -transparent "rgb(128,128,128)" 1.png

(I had it in a loop but tried this upon finding the error in order to confirm I hadn't made a mistake)

now gimp tells me the background of the picture rauch0000.bmp is 128,128,128 (or #808080) so this is what I use in the command. the files I am using is available here (the "rauch" {smoke} files are the ones causing trouble):

http://www.reinerstilesets.de/2d-grafiken/2d-animated/

under geschütz (the cannon) at the bottom, direct link here:
http://www.reinerstilesets.de/zips2d/Bgesch.zip

one of the worrying things that I found is that in addition to not setting the background to transparent as required (for the smoke {rauch} files only, curiously the rest of the files in the zip work, including the other ones with a 128,128,128 RGB background) the colour of the background gets changed.

anyone know what's going wrong here?

oh yeah, almost forgot:
$ convert -version
Version: ImageMagick 6.8.0-2 2012-12-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenCL
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error with convert and -transparent option

Post by fmw42 »

It works fine for me on IM 6.8.1.8 Q16 Mac OSX Snow Leopard:

convert rauch0000.bmp -transparent "rgb(128,128,128)" 1tmp1.png

1tmp1.png is has a transparent background.
crashandburn4
Posts: 4
Joined: 2013-01-04T07:34:22-07:00
Authentication code: 6789

Re: Error with convert and -transparent option

Post by crashandburn4 »

hmmm, double checked this by redownloading (incase I somehow had a corrupted file) and retesting this, still doesn't work for me:

convert rauch0000.bmp -transparent "rgb(128,128,128)" 1tmp1.png

1tmp1.png has a background of RGB 55,55,55 however for the explosions "explo0000.bmp" the background IS transparent.

(if you want to convert all of them at once I wrote a small bash script:

for f in *\ *.bmp; do mv "$f" "${f// /_}"; done
mkdir drawable-xhdpi
mkdir drawable
find * -prune -name '*.bmp' \
-exec convert '{}' -transparent "rgb(128,128,128)" drawable-xhdpi/'{}'.png \;
for f in drawable-xhdpi/*.png; do mv "$f" "${f//.bmp/}"; done

)

running ImageMagick 6.8.0-2 2012-12-17 Q16 on mac osx Mountain lion 10.8.2 can anyone else replicate the error? or the correct result like fmw42?

anyone have any ideas?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error with convert and -transparent option

Post by fmw42 »

I get your same bad results using IM 6.8.0.2 Q16 Mac OSX Snow Leopard. So it would appear to be a bug in that version of IM. You should consider upgrading your version of IM. There have been a lot of PNG bugs fixed. See http://www.imagemagick.org/script/changelog.php

Note it is transparent in 6.8.0.3. But I would suggest you upgrade as current as you can.
crashandburn4
Posts: 4
Joined: 2013-01-04T07:34:22-07:00
Authentication code: 6789

Re: Error with convert and -transparent option

Post by crashandburn4 »

thanks fmw42 will upgrade now. :)
crashandburn4
Posts: 4
Joined: 2013-01-04T07:34:22-07:00
Authentication code: 6789

Re: Error with convert and -transparent option

Post by crashandburn4 »

in case anyones wondering, the bug also appears to be on ImageMagick 6.8.0-7 too (latest version on macports)
I guess I'd better install from source... :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error with convert and -transparent option

Post by fmw42 »

crashandburn4 wrote:in case anyones wondering, the bug also appears to be on ImageMagick 6.8.0-7 too (latest version on macports)
I guess I'd better install from source... :(
I wrote this tutorial in response to a similar question. I install my delegates with MacPorts, but install IM manually so as to keep up with the IM versions.

viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202
Post Reply