You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Damjan Jovanovic (Commented) (JIRA)" <ji...@apache.org> on 2012/04/04 06:33:19 UTC
[jira] [Commented] (SANSELAN-68) Incorrect reading Physical
Width/Height Dpi and Physical Width/Height Inch from TIFF files
[ https://issues.apache.org/jira/browse/SANSELAN-68?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246015#comment-13246015 ]
Damjan Jovanovic commented on SANSELAN-68:
------------------------------------------
Please attach the patch as a separate file, and tick the "Grant license to ASF..." checkbox. That's the only way we can accept patches.
> Incorrect reading Physical Width/Height Dpi and Physical Width/Height Inch 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
> Labels: patch
>
> 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