-
-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modification to resolution handling in TIFF reader / writer #4185
base: master
Are you sure you want to change the base?
Conversation
…ithin TIFF file. TIFF writer now only sets resolution if this is really known, rather than setting a default value. The resolution of sub-resolution layers within a pyramid TIFF are now scaled depending on the sub-sampling of that layer.
Hi Ruven, Sorry, I don't think this is going to work. You can't use I think the correct fix would be to move xres/yres out of the vips image header and store it as generic metadata. Those values can be unset, so you could represent "no data available". It would break a lot of stuff though, so ... something for libvips 9.0. |
Yeah, I was a bit hesitant to make a pull request for this for as I was unsure of the wider impact. That's also why the I put the setting of the default to zero in a separate commit. However, having said that, it works perfectly for loading and saving to TIFF. And I'm not sure it's as big a problem as you think because:
Of course there may be things I've missed! |
I think those tests are trying to allow very small but still positive resolutions. I remember we used to have zero res in output file sometimes, and it caused a lot of problems downstream, including crashes in some apps. That was a good while ago, mind you. |
That's a common thing in downstream code working with eg. slide output, where resolution is usually expressed as microns per pixel. |
Vips currently sets a default X and Y resolution of 1.0 if no resolution information is found within an image file. Rather than write "fake" resolution information to a TIFF, this pull request modifies things so that the TIFF X/Y resolution is only written if this value is really known.
Also when writing a multi-resolution pyramid TIFF, identical resolution information is currently set for each layer in the pyramid. This information is now scaled by the sub-sampling factor so that the resolution now correctly represents what the resolution really is for each layer.
A similar change has also be made for PNG writing.