How to read an ico format picture in java?

victorio picture victorio · Jul 9, 2012 · Viewed 7.1k times · Source

I have a lot of .ico formatted pictures, and I want to use them in my Java SE project, but it doesn't know the format. How can I work around this?

Answer

Konrad Reiche picture Konrad Reiche · Jul 9, 2012

Try out image4j - Image Library for Java

The image4j library allows you to read and write certain image formats in 100% pure Java.

Currently the following formats are supported:

  • BMP (Microsoft bitmap format - uncompressed; 1, 4, 8, 24 and 32 bit)
  • ICO (Microsoft icon format - 1, 4, 8, 24 and 32 bit [XP uncompressed, Vista compressed])

With the library you can easily decode your ico file

List<BufferedImage> image = ICODecoder.read(new File("input.ico"));