Using the Toolkit class to load images often requires a MediaTracker to block program execution until the image is fully–loaded. You can query the image for its width and height (see Image api) once it is fully–loaded. Until then the methods return a value of -1. For the size you can use file.length if you can get a reference to a local (hard drive) file or for loading over the network you can use the URLConnection method getContentLength.
If you are using j2se 1.4+ you can use the ImageIO class for loading. The read methods return a BufferedImage which has its own methods for getting width and height (see BufferedImage api).
Hi there, I am using tool kit to load an image but I don't know to get the size, height and width of the image. Is there anyway to get these properties of the image? Thanks.