File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes problem with ImageIO.read Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "problem with ImageIO.read" Watch "problem with ImageIO.read" New topic
Author

problem with ImageIO.read

Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 302
The same code may work or fail in the same method:

The only difference that I can tell between the two calls is that it works with an array of size 493,563 and fails, returns null, with an array of size 563,472.

Your help will be greatly appreciated.

Alejandro Barrero


Your help will be greatly appreciated,
Alejandro Barrero
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 302
Found the problem. The byte array in the second case didn't correspond to an image. It would have been easier to detect if instead of null I had gotten a garbage image.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem with ImageIO.read
 
Similar Threads
Reading Image with JIMI
Loading JPG with JAI
NullPointerException
convert java.awt.Image to com.lowagie.text.Image
Exception with ImageIO.read