This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes width and height using image object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "width and height using image object" Watch "width and height using image object" New topic

width and height using image object

vidyadhar Joshi

Joined: Oct 15, 2002
Posts: 1
how to reterive width and height of a gif image using image object.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Did you happen to see the getWidth() and getHeight() methods on the Image class in the JavaDocs? They take an ImageObserver as a parameter, but all Components are ImageObservers, so you usually have no problem passing a parameter in. Usually it's a good idea to run your Image through a MediaTracker to make sure it's loaded before trying to get information from it...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
It is sorta covered in the JavaRanch Style Guide.
subject: width and height using image object
It's not a secret anymore!