This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 Java 8 in Action this week in the Java 8 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: 2093
    
    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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Image width & height return negative
 
Similar Threads
Urgent: Need to know the size of Image Uploaded
Image Observer
Problem in displaying an image
Adjusting the size of an image (jpg)?
Casting problem. Image to BufferedImage