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 Image width & height return negative Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Image width & height return negative" Watch "Image width & height return negative" New topic
Author

Image width & height return negative

Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190



I am getting -1 for both height and width, when in fact the JPG image is quite large
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2176
    
    7
I would guess the image hasn't been completely read into memory yet or you specified a bad file name.

You can try using ImageIO, or use a MediaTracker.
Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

 
Don't get me started about those stupid light bulbs.
 
subject: Image width & height return negative