Résumé: Definitely no way back to ICO?

Get help with using AutoHotkey and its commands and hotkeys
newbieforever
Posts: 274
Joined: 24 Aug 2016, 03:34

Résumé: Definitely no way back to ICO?

18 Sep 2018, 00:16

There seems to be no way to convert a PNG file to an ICO file.*

Is this definitely true? Just to be safe and not lose my time any longer: Can this be confirmed by an expert here?

Thank you very much in advance.

* By AHK methods only, without third-party tools; ico file containing image data in BMP format, not in PNG format; transparency preserved.
"No way back"...because it is so easy to convert ICO to PNG...
newbieforever
Posts: 274
Joined: 24 Aug 2016, 03:34

Re: Résumé: Definitely no way back to ICO?

21 Sep 2018, 01:30

...
No one here who would have mercy on me?
User avatar
nnnik
Posts: 3527
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Résumé: Definitely no way back to ICO?

21 Sep 2018, 07:52

This should be fairly easy with GDIp.
Recommends AHK Studio
newbieforever
Posts: 274
Joined: 24 Aug 2016, 03:34

Re: Résumé: Definitely no way back to ICO?

21 Sep 2018, 14:08

I know this post, but the script is no longer available. (And I guess that the script generates ico files with image data in png format.)
nnnik wrote: This should be fairly easy with GDIp.
Really? "Supported extensions are: .BMP,.DIB,.RLE,.JPG,.JPEG,.JPE,.JFIF,.GIF,.TIF,.TIFF,.PNG."
User avatar
nnnik
Posts: 3527
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Résumé: Definitely no way back to ICO?

22 Sep 2018, 01:45

Oh yeah true it would be easily possible with GDIp if you loaded an .ico and turned it into a png.
Anyways I think I found a solution:
First you load the image with gdip then you turn the resulting pBitmap into a hIcon and then you can save it to the file.
https://stackoverflow.com/questions/228 ... n-ico-file
These code pieces show how to save a hIcon to a file. They should give you an idea of what to do.
Recommends AHK Studio
newbieforever
Posts: 274
Joined: 24 Aug 2016, 03:34

Re: Résumé: Definitely no way back to ICO?

23 Sep 2018, 09:22

Thank you for your help, nnnik!

I know this posting too (I did a thorough research ;-)). But I assumed that the proposed solution is "nothing to write home about", because nobody here in the AHK community (where the problem was discussed several times!) has picked up this thread.

But anyway, "these code pieces show how to save a hIcon to a file" is far beyond my capabilities...
User avatar
nnnik
Posts: 3527
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Résumé: Definitely no way back to ICO?

23 Sep 2018, 13:07

The first example uses a COM Object. This shouldn't be too difficult to do in AHK.

the solutions after that essentially just produce the icon file by completely writing its content using binary data.
In AHK thats either a lot of ugly numputs and gets or you could use a file object.
Recommends AHK Studio

Return to “Ask For Help”

Who is online

Users browsing this forum: b00kay, Google [Bot], gwarble, JoeWinograd, vvhitevvizard and 92 guests