Imagemagick does it really "magic" with converting PNG->ICO
Posted: 2013-04-08T11:50:14-07:00
Hello,
Sorry for bothering imagemagick experts with a question which in fact is not really related to imagemagick. Imagemagick actually does a wonderful job, my problem is rather that I wrote a piece of java code to convert a 48x48 png icon into an ico icon, and the results slightly from what imagemagick does.
No doubt that imagemagick is not doing anything faulty, my problem is that I cannot find what I did wrong.
My aim is that the installer should create an ico file for MSWindows --- well, a simpler option would be that the ico file would also be stored inside the installer, and I would just unpack it, but I found that it would be funnier for me to write the code this way
The piece of code which I wrote is that one: http://jpicedt.cvs.sourceforge.net/view ... iew=markup
When I call it with the PNG icon which is there http://jpicedt.cvs.sourceforge.net/view ... iew=markup, with that sort of command line:
(these arguments cause the pngToIcoOfBmp function at line 111 to be called)
then the jpicedt.ico file which I get is different from that which I would get with convert, and the sole difference is that there is a 384 octets tailer added by imagemagick immediately after the pixel array, and also, consistently the bitmap length indicator is greate by 384 in the case of imagemagick than in my case.
So my question is about what this 384 octets tailer is ? is it part of the embedded bitmap, or is it part of the ico file. I could not understand why it is there based on the Wikipedia pages about ICO and BMP.
Any feedback is welcome --- even that sort of "you are out of scope, this is not the right place to raise such question"
Very best regards,
Vincent.
Sorry for bothering imagemagick experts with a question which in fact is not really related to imagemagick. Imagemagick actually does a wonderful job, my problem is rather that I wrote a piece of java code to convert a 48x48 png icon into an ico icon, and the results slightly from what imagemagick does.
No doubt that imagemagick is not doing anything faulty, my problem is that I cannot find what I did wrong.
My aim is that the installer should create an ico file for MSWindows --- well, a simpler option would be that the ico file would also be stored inside the installer, and I would just unpack it, but I found that it would be funnier for me to write the code this way
The piece of code which I wrote is that one: http://jpicedt.cvs.sourceforge.net/view ... iew=markup
When I call it with the PNG icon which is there http://jpicedt.cvs.sourceforge.net/view ... iew=markup, with that sort of command line:
Code: Select all
java -Xmx96m -classpath the_jar_with_pngToIco.jar installer.PngToIco --overwrite -i appicon.Cocorico.png -o jpicedt.ico
then the jpicedt.ico file which I get is different from that which I would get with convert, and the sole difference is that there is a 384 octets tailer added by imagemagick immediately after the pixel array, and also, consistently the bitmap length indicator is greate by 384 in the case of imagemagick than in my case.
So my question is about what this 384 octets tailer is ? is it part of the embedded bitmap, or is it part of the ico file. I could not understand why it is there based on the Wikipedia pages about ICO and BMP.
Any feedback is welcome --- even that sort of "you are out of scope, this is not the right place to raise such question"
Very best regards,
Vincent.