Skip to main content

Quick and Dirty Way to get Image Dimensions

By davidjmedlock



Free JavaScript Book!

Write powerful, clean and maintainable JavaScript.

RRP $11.95

…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!

New books out now!

Learn valuable skills with a practical introduction to Python programming!

Give yourself more options and write higher quality CSS with CSS Optimization Basics.