-
-
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
Support loading TIFF subIFD's #2557
Comments
Hello, yes, libvips supports this feature so adding it to sharp should be fairly straightforward. We'll need to expose the Line 317 in 0dc325d
Happy to accept a PR for this, if you're able. |
I think it wouldn't be too difficult to add an option in the constructor, but I have no clue (yet) how to go about having libvips return how many subIFD's there are in the first place. I haven't looked into that yet. |
It's just like the
ie. five layers in this pyramid, with the main image as layer 0 and four subifds. |
Commit 43a085d adds https://sharp.pixelplumbing.com/api-input#metadata This is available in v0.28.1. |
What are you trying to achieve?
I'm trying to load a DNG, and DNG's are saved in parts in TIFF subIFD's. Regardless, subIFD is part of the TIFF format, and there doesn't seem to be a way to specify a subIFD when loading a file/buffer, nor is there a way to know how many subIFD's a TIFF has.
Libvips appears to support this.
Also please note that subIFD is not the same as pages. The file I'm trying to read has 1 page, so the pages feature doesn't resolve this.
Also, I know very well that DNG isn't supported, but the issue is more general than that - subIFD is a TIFF standard, and DNG just happens to take advantage of it. Supporting this TIFF feature might be a step towards being able to read DNG with sharp - or at least decode the bits I need at a fairly awesome speed.
Have you searched for similar feature requests?
The word subIFD doesn't occur anywhere in this entire repo (well, it does now, but I mean before creating this issue).
What would you expect the API to look like?
Could be a property
subIFDs: Array<Buffer>
in themetadata()
object, each of which can be passed back into asharp()
constructor. This would be in line with other metadata, which are also returned as binary blobs.Another option would be to simply add
subIFDs: number
just to know how many there are. Then you could pass a subIFD index to the constructor likesharp('foo.dng', { subIFD: 2 })
. This would be somewhat in line with the libvips API.What alternatives have you considered?
A custom TIFF reader, but it's very slow and clunky. I'm sure lipvips can do much better.
Is there a sample image that helps explain?
Any ol' DNG will do, but I'll be happy to supply one, if need be.
The text was updated successfully, but these errors were encountered: