Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

image dimension

 
jonathan Greens
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks,
is it possible to get the image dimension from an image file?
my webapp allows user to upload image file and then display it. The issue here is that I need to shrink the image file proportionally to create a thumbnail and display these thumbnails in a table.
thanks!!
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can load it as a BufferedImage with ImageIO (j2se 1.4+) and get the dimensions with the BufferedImage getWidth/Height methods and use this to scale the images to final size. If using an older loading method (eg, ImageIcon, Toolkit getImage) you may need an ImageObserver (any Component) to get the dimensions.
 
It's exactly the same and completely different as this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!