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);
        System.out.println(imageInfo.getPhysicalWidthDpi());
} catch (ImageReadException e) {
        e.printStackTrace();
} catch (IOException e) {
        e.printStackTrace();
} catch (BadElementException e) {
        e.printStackTrace();
} 

The output is -1.

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

Regards,
George
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to