image-js / tiff

TIFF image decoder written entirely in JavaScript
MIT License
195 stars 17 forks source link

Added methods for counting pages #12

Closed lirbank closed 7 years ago

lirbank commented 7 years ago

Hi @targos - thanks a bunch for an awesome package! I am using it in a project where I simply need to know if the TIFF files are multi-page or plain 'ol single-page TIFF images. So I took the opportunity to add two new methods related to that.

So, I wanted to check in to see if you'd be open to merging a contribution? Happy to modify the PR as needed, this is just what I wrote for our own needs.

As an aside, I had some issues with decoding some of my test files (unsupported compression) but since all we need to know, at least at this point, is how many pages the TIFFs have (we do the rest of the decoding server side), this did the trick.

Thanks again for a great package!

cancan101 commented 7 years ago

out of curiosity, is there currently a way to actually access the various pages?

targos commented 7 years ago

tiff.decode() should return an array with all the pages

lirbank commented 7 years ago

Updated the PR as described above.

targos commented 7 years ago

Thanks! Landed in https://github.com/image-js/tiff/commit/7dac89ffc847e4e196daa0b1ae8831af599b9321 and published v3.0.0.