PIL only adds a dpi entry in the info dictionary if no resolution unit is specified in the TIFF file. This seems to be because of a misinterpretation of resolution unit values: they have a different meaning than in a JPEG file. JPEG: 0 = None; 1 = inches; 2 = cm. TIFF: 1 = None; 2 = inches; 3 = cm (see http://www.awaresystems.be/imaging/tiff/tifftags/resolutionunit.html and http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html)
Here's a quick fix: Open TiffImagePlugin.py and go to line 577. Change the code: xres = getscalar(X_RESOLUTION, (1, 1)) yres = getscalar(Y_RESOLUTION, (1, 1)) if xres and yres: xres = xres[0] / (xres[1] or 1) yres = yres[0] / (yres[1] or 1) resunit = getscalar(RESOLUTION_UNIT, 1) if resunit == 2: # Inches self.info["dpi"] = xres, yres elif resunit == 3: # Centimeters self.info["dpi"] = xres * 2.54, yres * 2.54 else: # No absolute unit of measurement. self.info["resolution"] = xres, yres Regards, Florian Hoech _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig