Page 1 of 1

Transparent background sometimes appears black

Posted: 2009-02-22T22:57:28-07:00
by gottasolveit
I'm using ImageMagick to convert .ico files into transparent .gif files. I'll download a favicon, http://twitter.com/favicon.ico, for example, and convert it to a .gif using the following:

Code: Select all

convert -resize 32x32! -sharpen 10 favicon.ico[0] favicon.gif
In Windows, this works just great. On Linux, sometimes the icons have a black background instead of transparent.

After converting this -- the resulting .gif is this:
http://www.quantcast.com/favicon.ico -- transparent background in both Windows and Linux
http://twitter.com/favicon.ico -- transparent background in Windows, black background in Linux

Anybody know the cure?

Thanks!

Re: Transparent background sometimes appears black

Posted: 2009-02-24T13:38:43-07:00
by gottasolveit
Nobody can offer any insight? This seems like an easy enough problem

Re: Transparent background sometimes appears black

Posted: 2009-02-24T14:58:03-07:00
by fmw42
I know nothing about ico files, but both your examples show transparent backgrounds on my Mac OSX using Safari for the browser.

Also see the information about IM 6 syntax at http://www.imagemagick.org/Usage/basics/#cmdline

what IM version are you using

convert -list configure

should show you the full version as 6.4.9-6 for the latest. Perhaps you just have a too old version of IM.

Perhaps you should post a copy of your original file so it can be checked to see if corrupt or some oddity.

Re: Transparent background sometimes appears black

Posted: 2009-03-02T23:45:34-07:00
by gottasolveit
fmw42 wrote:I know nothing about ico files, but both your examples show transparent backgrounds on my Mac OSX using Safari for the browser.
Icons display properly in the browser as being transparent. The problem is when I convert them to a .gif using ImageMagick.

I'm on Ubuntu and have compiled ImageMagick from source. (The default package was somewhat outdated). So, now I'm at version 6.4.9-8.. and I still have this problem.

I'm using this command:

convert -resize 32x32! -sharpen 10 favicon.ico[0] favicon.gif

To test this, download this .ico file: http://twitter.com/favicon.ico
..and try to convert it using the command above. I end up with a black backgrounded .gif instead of transparent one. Does this happen for you?

How do I fix this? Am I using "convert" improperly?


Again, just to clarify, .ico files have transparency. When I use ImageMagick to convert a .ico to a .gif, sometimes the .gif ends up having a black background instead of transparent. This happens about half the time when I use ImageMagick on Linux to convert, but *not* when I use Windows ImageMagick to convert.

Re: Transparent background sometimes appears black

Posted: 2009-03-03T18:15:02-07:00
by fmw42
gottasolveit wrote:
fmw42 wrote:I know nothing about ico files, but both your examples show transparent backgrounds on my Mac OSX using Safari for the browser.
Icons display properly in the browser as being transparent. The problem is when I convert them to a .gif using ImageMagick.

I'm on Ubuntu and have compiled ImageMagick from source. (The default package was somewhat outdated). So, now I'm at version 6.4.9-8.. and I still have this problem.

I'm using this command:

convert -resize 32x32! -sharpen 10 favicon.ico[0] favicon.gif

To test this, download this .ico file: http://twitter.com/favicon.ico
..and try to convert it using the command above. I end up with a black backgrounded .gif instead of transparent one. Does this happen for you?

How do I fix this? Am I using "convert" improperly?


Again, just to clarify, .ico files have transparency. When I use ImageMagick to convert a .ico to a .gif, sometimes the .gif ends up having a black background instead of transparent. This happens about half the time when I use ImageMagick on Linux to convert, but *not* when I use Windows ImageMagick to convert.

All of these commands work fine for me an leave the background transparent:

convert favicon.ico favicon.gif
convert favicon.ico -resize 32x32! -sharpen 10 favicon2.gif
convert favicon.ico[0] -resize 32x32! -sharpen 10 favicon3.gif
convert -resize 32x32! -sharpen 10 favicon.ico[0] favicon4.gif

I am on IM 6.4.9-8 Q16 Mac OSX Tiger

No black background.

What viewer are you using to look at your images? Perhaps IE?