Incorrect reading Physical Width/Height Dpi and Physical Width/Height from TIFF
files
-------------------------------------------------------------------------------------
Key: SANSELAN-68
URL: https://issues.apache.org/jira/browse/SANSELAN-68
Project: Commons Sanselan
Issue Type: Bug
Components: Format: TIFF
Affects Versions: 1.0, 1.1, 1.x
Reporter: VVD
Width: 3509
Physical Width Dpi: 4650
Physical Width Inch: 1169.667
Height: 2481
Physical Height Dpi: 4650
Physical Height Inch: 827.00024
{code}
TiffImageParser.java (196):
- case 3: // Meter
- unitsPerInch = 0.0254;
+ case 3: // Centimeter
+ unitsPerInch = 2.54;
(c) http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf
TiffImageParser.java (218):
- physicalWidthDpi = (int) (XResolutionPixelsPerUnit /
unitsPerInch);
+ physicalWidthDpi = (int) Math.round(XResolutionPixelsPerUnit *
unitsPerInch);
TiffImageParser.java (226):
- physicalHeightDpi = (int) (YResolutionPixelsPerUnit /
unitsPerInch);
+ physicalHeightDpi = (int) Math.round(YResolutionPixelsPerUnit
* unitsPerInch);
{code}
After this patch I got correct values:
Width: 3509
Physical Width Dpi: 300
Physical Width Inch: 11.69667
Height: 2481
Physical Height Dpi: 300
Physical Height Inch: 8.2700024
May be need to patch writing of tiff image too - don't know.
P.S. GIMP show values: 300,000, 300,000, 11,697, 8,270.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira