Question

What tool can I use to convert a .ICO file to a .PNG file?

Was it helpful?

Solution

Free: @icon sushi is very good for working with icons:

Features

  • icon sushi can convert image files into icon files and vice versa.
  • Support for Windows Vista large icons. (convert large image with PNG compression)
  • Support for Windows XP 32bit Icons.
  • Support for Multiple-Icon which contains some icons in a file.
  • Edit Alpha channel and Transparency-Mask.
  • Open 1x1 to 256x256 size of images.
  • Open 1/4/8/24/32bits color images.
  • Open: ICO/BMP/PNG/PSD/EXE/DLL/ICL, Convert into: ICO/BMP/PNG/ICL
  • Copy to / Paste from Clipboard.

OTHER TIPS

Google has an ico to png converter, I saw it on reddit the other day.

http://www.google.com/s2/favicons?domain=stackoverflow.com

ImageMagick can convert practically any widely used image format to another.

http://www.imagemagick.org/script/index.php

see http://www.imagemagick.org/script/convert.php in particular

There are ImageMagick bindigs for most popular languages.

I did it this way in C# does the job nicely

#region Usings

using System;
using System.IO;
using System.Linq;
// Next namespace requires a reference to PresentationCore
using System.Windows.Media.Imaging;

#endregion

namespace Imagetool
{
internal class Program
{
    private static void Main(string[] args)
    {
        new Ico2Png().Run(@"C:\Icons\",
                          @"C:\Icons\out\");
    }
}

public class Ico2Png
{
    public void Run(string inPath, string outPath)
    {
        if (!Directory.Exists(inPath))
        {
            throw new Exception("In Path does not exist");
        }

        if (!Directory.Exists(outPath))
        {
            Directory.CreateDirectory(outPath);
        }


        var files = Directory.GetFiles(inPath, "*.ico");
        foreach (var filepath in files.Take(10))
        {
            Stream iconStream = new FileStream(filepath, FileMode.Open);
            var decoder = new IconBitmapDecoder(
                iconStream,
                BitmapCreateOptions.PreservePixelFormat,
                BitmapCacheOption.None);

            var fileName = Path.GetFileName(filepath);

            // loop through images inside the file
            foreach (var frame in decoder.Frames)
            {
                // save file as PNG
                BitmapEncoder encoder = new PngBitmapEncoder();
                encoder.Frames.Add(frame);
                var size = frame.PixelHeight;

                // haven't tested the next lines - include them for bitdepth
                // See RenniePet's answer for details
                // var depth = frame.Thumbnail.Format.BitsPerPixel;
                // var path = outPath + fileName + size + depth +".png";

                var path = outPath + fileName + size + ".png";
                using (Stream saveStream = new FileStream(path, FileMode.Create))
                {
                    encoder.Save(saveStream);
                }
            }
        }
    }
}
}

Note: This was free when this question was asked but apparently it's a paid app now. @Sean Kearon should change the "correct answer" now.

You can use IcoFX ($59)

It is an all-in-one solution for icon creation, extraction and editing. It is designed to work with Windows XP, Windows Vista and Macintosh icons supporting transparency.

ConvertICO.com has always worked fine for me.

I don't know where I would be without IrFanView. Fantastic for batch converting images, including ico to png.

In the terminal on mac:

convert favicon.ico favicon.png

In case anyone want to convert with Python Imaging Library (PIL) in memory from a file or url

from cStringIO import StringIO
import Image
import urllib

def to_png(path, mime="png"):
    if path.startswith("http:"):
        url = urllib.quote(url)
        input = StringIO()
        input.write(urllib.urlopen(url).read())
        input.seek(0)
    else:
        input = open(path).read()

    if input:
        out  = StringIO()
        image = Image.open(input)
        image.save(out, mime.upper())
        return out.getvalue()
    else:
        return None

One quick option is to download Paint.net and install the Icon/Cursor plugin. You can then open .ico files with Paint.net, edit them, and save them to .png or another format.

For batch processing, I second the suggestions of ImageMagick or IrFanView.

http://converticon.com/ is also a candidate.

Check out http://iconverticons.com/ - iConvert allows you to easily convert Windows ico to Mac OS X icns, SVG to Windows icons, PNG ico to Mac OS X ico, JPG images to Windows icons, and much more.

Here is some C# code to do it, based very much on the answer on this thread by "Peter". (If you find this answer useful, please up-vote Peter's answer.)

  /// <summary>
  /// Method to extract all of the images in an ICO file as a set of PNG files. The extracted 
  /// images are written to the same disk folder as the input file, with extended filenames 
  /// indicating the size of the image (16x16, 32x32, etc.) and the bit depth of the original 
  /// image (typically 32, but may be 8 or 4 for some images in old ICO files, or even in new 
  /// ICO files that are intended to be usable in very old Windows systems). But note that the 
  /// PNG files themselves always have bit depth 32 - the bit depth indication only refers to 
  /// the source image that the PNG was created from. Note also that there seems to be a bug 
  /// that makes images larger than 48 x 48 and with color depth less than 32 non-functional.
  /// 
  /// This code is very much based on the answer by "Peter" on this thread: 
  /// http://stackoverflow.com/questions/37590/how-to-convert-ico-to-png
  /// 
  /// Plus information about how to get the color depth of the "frames" in the icon found here:
  /// http://social.msdn.microsoft.com/Forums/en-US/e46a9ad8-d65e-4aad-92c0-04d57d415065/a-bug-that-renders-iconbitmapdecoder-useless
  /// </summary>
  /// <param name="iconFileName">full path and filename of the ICO file</param>
  private static void ExtractImagesFromIconFile(string iconFileName)
  {
     try
     {
        using (Stream iconStream = new FileStream(iconFileName, FileMode.Open))
        {
           IconBitmapDecoder bitmapDecoder = new IconBitmapDecoder(iconStream, 
                               BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.None);

           foreach (BitmapFrame bitmapFrame in bitmapDecoder.Frames)
           {
              int iconSize = bitmapFrame.PixelHeight;
              int bitDepth = bitmapFrame.Thumbnail.Format.BitsPerPixel;
              string pngFileName = Path.GetDirectoryName(iconFileName) + 
                                   Path.DirectorySeparatorChar +
                                   Path.GetFileNameWithoutExtension(iconFileName) + "-" +
                                   iconSize + "x" + iconSize + "-" + bitDepth + ".png";
              using (Stream saveStream = new FileStream(pngFileName, FileMode.Create))
              {
                 BitmapEncoder bitmapEncoder = new PngBitmapEncoder();
                 bitmapEncoder.Frames.Add(bitmapFrame);
                 bitmapEncoder.Save(saveStream);
              }
           }
        }
     }
     catch (Exception ex)
     {
        MessageBox.Show("Unable to extract PNGs from ICO file: " + ex.Message,
                       "ExtractImagesFromIconFile", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
  }

XnView is a great graphics utility for Windows/Mac/Linux (free) (download page) that will let you browse images, batch convert, transform, resize, rotate, take screenshots etc.

It can do your XYZ to ICO conversion where XYZ is almost any format under the sun.

alt text http://img443.imageshack.us/img443/672/convert.gif

http://www.gimp.org/

free and powerful way to make large resolution .ico files 1024x1024 or greater work with win7 at least, I've tested that :)

just save and type .ico

:)

transparency is easy, load a new image and select advanced options, background color->transparency

The version of Paint that ships with Windows 7 will convert Icons to PNG, JPEG, ect... now.

I just ran into this issue. FYI open the .ico in paint and save as .png. Worked for me!

http://convertico.org/ allows users to convert multiple ico files to PNG, GIF or JPG files in one step.

This is probably a rather silly answer, but if you only need one icon, you could just take a screenshot of the icon in the folder and chop out the part you want. Make sure the icon is showing the size you want and has a white background, of course.

If you are using a decent screenshot application like SnagIt or WinSnap, a region snap should take care of it within a few seconds.

Note that this won't give you transparency.

If you'r not looking for something programmatic then just 'Print Screen' and crop.

There is an online conversion tool available at http://www.html-kit.com/favicon/. In addition to generating the .ico it will also give you an animated .gif version.

Icon Convert is another online tool with resize option.

Another alternative would be IrfanView

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top