Converting ICO file to PNG using PHP

I’ve been look­ing for a while for a way to con­vert ICO files to PNG to eas­ily dis­play them on the web page.

There is a nice class in PHP­Classes site writ­ten by Joshua Hat­field that does just that.

Haven’t tried it myself, but the code looks promis­ing enough, and the sam­ple works pretty good.

See the class in action here: http://www.phpclasses.org/browse/package/3906.html

3 Comments to “Converting ICO file to PNG using PHP”

  1. Joshua "Flobi" Hatfield 6 April 2009 at 21:05 #

    Thanks for the kudos. Con­grats on the new Word­Press instal­la­tion. I would add that if you’re sim­ply look­ing to con­vert an icon to PNG, you could just use my sam­ple on my web­site as it dis­plays them as PNGs. That’s at http://blog.flobi.com/test/floIcon/ . The php class actu­ally con­verts the icon to a GD resource for PHP, but there’s a con­ve­nient imagepng() func­tion that will save them in PNG for­mat (also image­jpeg() and imagegif(), but they don’t sup­port alpha trans­parency, and no trans­parency for jpeg).

  2. GarykPatton 16 June 2009 at 09:12 #

    I have been look­ing look­ing around for this kind of infor­ma­tion. Will you post some more in future? I’ll be grate­ful if you will.

  3. admin 16 June 2009 at 15:01 #

    @GarykPatton: Yea, Will try.
    I’m build­ing an appli­ca­tion that will store my entire icons col­lec­tion in a data­base that will be sortable and eas­ily searched.

    If I have more on the info (like cre­at­ing ICO files from PNG for­mats) will post :)


Leave a Reply