+ // set the image resolution if it's available
+ uint16 tiffRes;
+ if ( TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &tiffRes) )
+ {
+ wxImageResolution res;
+ switch ( tiffRes )
+ {
+ default:
+ wxLogWarning(_("Unknown TIFF resolution unit %d ignored"),
+ tiffRes);
+ // fall through
+
+ case RESUNIT_NONE:
+ res = wxIMAGE_RESOLUTION_NONE;
+ break;
+
+ case RESUNIT_INCH:
+ res = wxIMAGE_RESOLUTION_INCHES;
+ break;
+
+ case RESUNIT_CENTIMETER:
+ res = wxIMAGE_RESOLUTION_CM;
+ break;
+ }
+
+ if ( res != wxIMAGE_RESOLUTION_NONE )
+ {
+ float xres, yres;
+ if ( TIFFGetField(tif, TIFFTAG_XRESOLUTION, &xres) )
+ image->SetOption(wxIMAGE_OPTION_RESOLUTIONX, wxRound(xres));
+
+ if ( TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres) )
+ image->SetOption(wxIMAGE_OPTION_RESOLUTIONY, wxRound(yres));
+ }
+ }
+
+