Skip to main content

Quick and Dirty Way to get Image Dimensions

By davidjmedlock

…posted by davidjmedlock:

img = tk.getDefaultToolkit().getImage("C:image.jpg");
width = img.getWidth();
height = img.getHeight();


I’m by no means a master of all things Java, but this is an easy way to grab the height and width of an image. I haven’t tried it with GIF’s just yet, but I think it’ll work… Enjoy!

Integromat Tower Ad