0

Possible Duplicate:
How to define DPi for a new JPG image?

Is there a way to get a resolution (pixels per inch) of an image in Java? Either with Native APIs or third party libraries. I don't just want the height and width of an image but actually the resolution that determines the output quality of an image.

Community
  • 1
  • 1
Omnipresent
  • 29,434
  • 47
  • 142
  • 186

1 Answers1

4

An image has only pixels. it has not ppi.
a monitor, an image sensor and an printer have ppi because they all have dots/pixels related to a measurable distance in inch.

ppi is short for pixels per inch, and therefore a measure for pixel density.

for calculation of ppi / dpi see http://en.wikipedia.org/wiki/Dots_per_inch
You simply divide the number of pixels or points by the number of inch that the output device or photo paper has.
But be carefull if points or pixels is wanted.

AlexWien
  • 28,470
  • 6
  • 53
  • 83
  • so what would be the best way to get a resolution (output quality) of an image? I would assume that height and width alone won't be good enough to determine the output quality...right? – Omnipresent Jan 08 '13 at 01:26