Quick and Dirty Way to get Image Dimensions

By davidjmedlock
We teamed up with SiteGround
To bring you up to 65% off web hosting, plus free access to the entire SitePoint Premium library (worth $99). Get SiteGround + SitePoint Premium Now

…posted by davidjmedlock:





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

#width#
#height#

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!

We teamed up with SiteGround
To bring you up to 65% off web hosting, plus free access to the entire SitePoint Premium library (worth $99). Get SiteGround + SitePoint Premium Now
Login or Create Account to Comment
Login Create Account