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 (Resolved) (JIRA)" <ji...@apache.org> on 2012/04/12 05:42:40 UTC

[jira] [Resolved] (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:all-tabpanel ]

Damjan Jovanovic resolved SANSELAN-68.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0

Patch applied to latest SVN. Thank you for your contribution!
                
> 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
>             Fix For: 1.0
>
>         Attachments: sanselan-tiff-dpi.diff
>
>
> 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