Page 1 of 1
Problems converting PNG to ICO
Posted: 2012-06-03T09:02:45-07:00
by dw415
I've been trying to convert a 16x16 PNG to ICO for use as a website favicon, but it never comes out right.
Code: Select all
convert favicon.png -colors 256 favicon.ico
Here is the input image file:
http://cure.org/img/favicon.png
The above command produces an ICO that shows as a solid-color green square in IE. So I thought maybe it is some sort of transparency or channels issue. I tried adding -flatten then -transparent white to no avail.
Code: Select all
$ convert -version
Version: ImageMagick 6.2.8 05/07/12 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC
Re: Problems converting PNG to ICO
Posted: 2012-06-03T10:45:06-07:00
by fmw42
I don't know much about ico files, but try
convert 1favicon.png +matte -type palette 1favicon.ico
P.S it could be a bug in your version of IM. Version 6.2.8 is ancient. (Nearly 500 versions old).
Re: Problems converting PNG to ICO
Posted: 2012-06-04T06:49:23-07:00
by dw415
No luck with the suggested command. I tried all of the following commands under a newer ImageMagick:
Code: Select all
convert favicon.png favicon.ico
convert favicon.png -colors 256 favicon.ico
convert favicon.png -colors 256 -flatten favicon.ico
convert favicon.png -colors 256 -transparent white favicon.ico
convert favicon.png +matte -type palette favicon.ico
The ICO displays in popular web browsers either garbled or solid green.
Code: Select all
$ convert -version
Version: ImageMagick 6.6.9-7 2012-04-30 Q16 http://imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
Re: Problems converting PNG to ICO
Posted: 2012-06-04T07:22:59-07:00
by dw415
Actually it looks as though the last round of commands all worked. I was being fooled when testing by browser caching behaviors apparently. The ImageMagick version (CentOS 5 release) appears to have been the problem.
So the following command produced an ICO which displayed correctly in popular web browsers after using the newer ImageMagick 6.6.9-7:
Re: Problems converting PNG to ICO
Posted: 2016-01-07T10:26:44-07:00
by AlexMorse2016
Ive got the ICO being output, but when I add in "-color 8", or "-color 16", it immediately starts showing a solid garbled background and bad aliasing. the icon looks good with this output, but I want to reduce the colors a bit more, to save file-size:
convert /icons/newstimes-01.png -define icon:auto-resize=16 /icons/new_favicon.ico
Any suggestions for how I can keep the transparency and aliasing looking good, but to also then reduce colors a bit?
Re: Problems converting PNG to ICO
Posted: 2016-01-07T10:46:59-07:00
by fmw42
try -colors not -color