Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

image dimensions  RSS feed

 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I have a servlet that permits the upload of image files (gif, jpg). The code I have can restrict the size of the file being uploaded, but I don't know of a way to test the actual dimensions of the file (width and height). I would like to have that capability. Does anyone know how to measure the dimensions of an image programmatically once you have the image file?

Thanks, Alan

Here are snippets of my existing code:

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks to me like the javax.imageio and related packages have the classes and methods you need.
Bill
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A quick and easy way to get the dimensions is to use the ImageInfo class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!