Converting to large ICO format

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Mahroun
Posts: 23
Joined: 2011-12-24T02:52:08-07:00
Authentication code: 8675308

Converting to large ICO format

Post by Mahroun »

I'm trying to convert to ICO format with many sizes including large ones.
I'm able to view the output image in image viewers but my app can't access the ones larger than 256, opening the same output image in Axialis IconWorkshop and saving it (without modification) will make it work.
I'm I missing something in the command line?

Code: Select all

convert.exe "c:\output_image.jpg"
	-gravity center
	( -clone 0 -resize 120x120 ( +clone -background black -shadow 80x2+0+0 ) +swap -background transparent -layers merge -extent 128x128 )
	( -clone 0 -resize 248x248 ( +clone -background black -shadow 80x2+0+0 ) +swap -background transparent -layers merge -extent 256x256 )
	( -clone 0 -resize 376x376 ( +clone -background black -shadow 80x2+0+0 ) +swap -background transparent -layers merge -extent 384x384 )
	( -clone 0 -resize 504x504 ( +clone -background black -shadow 80x2+0+0 ) +swap -background transparent -layers merge -extent 512x512 )
	-delete 0 -alpha on -type TrueColorMatte -compress Zip
	"c:\output_image.ico"
Help appreciated.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Converting to large ICO format

Post by glennrp »

coders/icon.c has this in the encoding section

Code: Select all

    if ((image->columns > 256L) || (image->rows > 256L))
      ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
The icon format limits the dimensions to a maximum of 256x256.
Mahroun
Posts: 23
Joined: 2011-12-24T02:52:08-07:00
Authentication code: 8675308

Re: Converting to large ICO format

Post by Mahroun »

Are you saying I can't include larger than 256 images in an ICO file?
So why does it work just by opening the image and saving it in Axialis IconWorkshop without any modification?
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Converting to large ICO format

Post by glennrp »

Mahroun wrote:Are you saying I can't include larger than 256 images in an ICO file?
You cannot include them if you use ImageMagick to write your ICO files.
So why does it work just by opening the image and saving it in Axialis IconWorkshop without any modification?
It works because the ICO format is not well specified, and some applications allow larger images than 256x256. ImageMagick
tries to write ICO files that can be read by most if not all applications.
See http://en.wikipedia.org/wiki/ICO_%28file_format%29
Note that the width and height are one-byte fields and thus are limited to 256x256 (zero being defined to mean 256).
I can't find an actual spec. The wiki doesn't say what is supposed to happen if the PNG dimensions aren't
the same as the ICO header dimensions. It would be interesting to see what Axialis puts in the ICO header
when width or height exceeds 256.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Converting to large ICO format

Post by Bonzo »

Axialis IconWorkshop icons may not be "traditional icons", they just call them that.
Android, iPhone OS and Windows Phone operating systems define new standards for icons. IconWorkshop lets you create in minutes icons following the specifications of those operating systems.
There are new specifications coming out for things everyday but a lot of them do not last. Do you want the IM developers to drop everything else and change the code for something that may not last?
Mahroun
Posts: 23
Joined: 2011-12-24T02:52:08-07:00
Authentication code: 8675308

Re: Converting to large ICO format

Post by Mahroun »

I didn't know about the limitations, and Its kinda let down, I wrote a movie library app and wanted to include many sizes in one file to quickly switch view size.
But now I think its better to thumbnail large none-ico images.

Thanks for the help guys :)
Post Reply