2012.07.05 16:10 "Re: [Tiff] How to set the "physical size" of an image when writing a Tiff file?", by Olivier Paquet
On Thu, Jul 5, 2012 at 11:53 AM, Simon Ochsenreither <email@example.com> wrote:
> I ran tiffinfo on the file and the resolution seems to be off. I grepped the > output, so that it only prints the resolution, and I got the following:
Yes, infinite is clearly wrong.
> All the images have the same pixel width and height. Is resolution computed > from other values or is it set by the user?
It is set directly but it is a rational value (a / b) so it is possible the software writing the TIFF did something bad. Try tiffdump, it might give more information about the invalid values in some cases.
> This drift from infinity to other values is very weird. Shouldn't it be the > same value?
> What do you recommend?
Anything goes when something is invalid. Try tiffdump and see what the resolution looks like there. Either way, it's quite likely the TIFF resolution metadata is hopelessly broken. However, the physical size you're after appears to be also stored in an XML blob in the ImageDescription tag. You should look into parsing that if you must read these files and they can't be fixed at the source. It's not standard obviously but it'll get you something which works. If you can get the software generating the files fixed, even better.