Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-19

Incorrect reading Physical Width/Height Dpi and Physical Width/Height Inch from TIFF files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-alpha1, 1.1, 1.x
    • 1.0-alpha1
    • Format: TIFF

    Description

      Width: 3509
      Physical Width Dpi: 4650
      Physical Width Inch: 1169.667
      Height: 2481
      Physical Height Dpi: 4650
      Physical Height Inch: 827.00024

      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);
      

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vvd VVD
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: