This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 2156
    
    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

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Image width & height return negative
 
Similar Threads
Adjusting the size of an image (jpg)?
Casting problem. Image to BufferedImage
Image Observer
Urgent: Need to know the size of Image Uploaded
Problem in displaying an image