commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Wei" <>
Subject [sanselan]How to read resolution of a JPEG image without Exif?
Date Sat, 08 Oct 2011 23:06:32 GMT
Dear all,

I have a JPEG image which colorspace is CMYK and it has no Exif information.

When I use Photoshop open it, I can see its resolution is 600DPI. I also can read its resolution
by right-click it in Windows Explorer, then select menuitem "Properties", then switch to tab
"Summary", at last click button "Advanced".

I have to read its resolution in my Java application. I've tried several imaging tools/libraries
like JAI Image/IO Tools, Apache FOP, Apache Sanselan, iText, but I always failed.

for Sanselan, the test code is as follows:

try {
	File file = new File("C:/hs8mm.jpg");
	ImageInfo imageInfo = Sanselan.getImageInfo(file);
} catch (ImageReadException e) {
} catch (IOException e) {
} catch (BadElementException e) {

The output is -1.

Is there another way to read the resolution? Thanks for any help.


View raw message