]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
[Bug 366] tiff resolution units interpretation should default as inches
authorDarren Nickerson <darren.nickerson@ifax.com>
Sat, 8 Feb 2003 23:50:51 +0000 (23:50 +0000)
committerDarren Nickerson <darren.nickerson@ifax.com>
Sat, 8 Feb 2003 23:50:51 +0000 (23:50 +0000)
Default to RESUNIT_INCH instead of RESUNIT_NONE to bring us in line with
TIFF spec. Also treat RESUNIT_NONE as PostScript units, which follows
libtiff behaviour. This work contributed by Chris Bainbridge, and filed
here by Lee. Thanks! -d

faxd/FaxSend.c++
hfaxd/RecvQueue.c++
util/faxinfo.c++
util/tiffcheck.c++

index c3783bc81107a7143f25113311c77678c3a773d8..1a61a11cde54c53103e79247e59aa825afd48bb3 100644 (file)
@@ -572,10 +572,12 @@ FaxServer::sendSetupParams1(TIFF* tif,
      */
     float yres;
     if (TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres)) {
-       short resunit = RESUNIT_NONE;
+       short resunit = RESUNIT_INCH;           // TIFF spec default
        (void) TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &resunit);
        if (resunit == RESUNIT_INCH)
            yres /= 25.4;
+       if (resunit == RESUNIT_NONE)
+           yres /= 720.0;                      // postscript units ?
     } else {
        /*
         * No vertical resolution is specified, try
index 85f64f3e41483fefd7dd28ac3f0d3ceec3b64b73..2c5bee35d1350372833fe7cd704ecd20aaed1f1b 100644 (file)
@@ -112,10 +112,12 @@ HylaFAXServer::getRecvDocStatus(RecvInfo& ri)
 #endif
     float vres = 3.85;                                 // XXX default
     if (TIFFGetField(tif, TIFFTAG_YRESOLUTION, &vres)) {
-       uint16 resunit = RESUNIT_NONE;
+       uint16 resunit = RESUNIT_INCH;                  // TIFF spec default
        TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &resunit);
        if (resunit == RESUNIT_INCH)
            vres /= 25.4;
+       if (resunit == RESUNIT_NONE)
+           vres /= 720.0;                              // postscript units ?
     }
     ri.params.setVerticalRes((u_int) vres);            // resolution
     TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &v);
index f0096d923f32ecb0794dc59601357f66819cb22f..991aba735c546177f0bb64b8b7eb48b1780b2c4a 100644 (file)
@@ -102,10 +102,12 @@ main(int argc, char** argv)
 #endif
     float vres = 3.85;                                 // XXX default
     if (TIFFGetField(tif, TIFFTAG_YRESOLUTION, &vres)) {
-       uint16 resunit = RESUNIT_NONE;
+       uint16 resunit = RESUNIT_INCH;                  // TIFF spec default
        TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &resunit);
        if (resunit == RESUNIT_INCH)
            vres /= 25.4;
+       if (resunit == RESUNIT_NONE)
+           vres /= 720.0;                              // postscript units ?
     }
     params.setVerticalRes((u_int) vres);               // resolution
     TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &v);
index f9fbc7609a1dff91a24dd2fcca62d10c1698d589..59c8eeb264c7c47aeb6bebcfdeb3427307ef51db 100644 (file)
@@ -185,10 +185,12 @@ checkPageFormat(TIFF* tif, fxStr& emsg)
      */
     float yres;
     if (TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres)) {
-       short resunit = RESUNIT_NONE;
+       short resunit = RESUNIT_INCH;           // TIFF spec default
        (void) TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &resunit);
        if (resunit == RESUNIT_CENTIMETER)
            yres *= 25.4f;
+       if (resunit == RESUNIT_NONE)
+           yres *= 720.0f;             // postscript units ?
        yres = (yres >= 150 ? 196 : 98);        // convert to well-known values
     } else {
        /*