-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
metadata: expose VIPS_META_PAGE_HEIGHT, VIPS_META_N_PAGES, requires libvips v8.7.0 #1205
Comments
Does libvips have a way to count the number of TIFF directories? There are some situations (e.g. concatenated documents) where height may vary by page. |
libvips requires that all the heights (and a few other properties) are the same when reading multiple "pages" of a TIFF file. |
If I'm reading correctly, it looks like that requirement only holds when you are retrieving more than one page at a time. In the test cases for PR #1204, we're successfully loading different sized pages from the same file. Before the snippet you linked, there is a call to rtiff_n_pages -- it appears to count the number of TIFF directories without requiring uniformity. |
Good point, thank you, for multi-page TIFF input this only makes sense after the |
Better yet, we can use VIPS_META_N_PAGES, available in the future libvips v8.7.0, for the value of |
Thanks @lovell, you beat me to it. jcupitt was quick with that commit. How do you manage development against the latest libvips changes? Willing to test and PR this, but I'm not sure where to start. |
Features that require the future libvips v8.7.0 will need to wait until (a) it's released and (b) the next "major" version of sharp that places a minimum dependency on that version of libvips, which is likely to be sharp v0.21.0. |
v0.21.2 now available with this feature. |
Multi-page images e.g. TIFF are treated by libvips as a "toilet-roll" image. sharp could expose this information via the existing
metadata
feature.If an image has the
VIPS_META_PAGE_HEIGHT
integer property set, add two new properties tometadata()
response:pageHeight
: the value ofVIPS_META_PAGE_HEIGHT
pages
: the (total)height
divided byVIPS_META_PAGE_HEIGHT
, i.e. the number of pagesThe text was updated successfully, but these errors were encountered: