samvera / node-iiif

This module provides a full-featured IIIF Image API 2.1 and 3.0 image processor. It covers only the image processing pipeline itself, leaving input and output to the caller.
Apache License 2.0
27 stars 5 forks source link

Add density option; improve tests & documentation #18

Closed mbklein closed 3 years ago

mbklein commented 3 years ago

This PR has three distinct commits in order to make review easier, but they should be squashed on commit.

The new feature is the addition of a density option to the constructor, which tells the processor to assert a given pixel density (in pixels per inch) in the output image. This has absolutely no effect on the size or quality of the image; it's simply a convenience so that images show up at a reasonable size when imported into Photoshop, Illustrator, or InDesign.

In adding this option, I also refactored the new Processor() constructor so that it can take two different forms:

The old way (for backward compatibility; will give a deprecation warning):

new Processor(url, streamResolver, [dimensionFunction], [maxWidth], [includeMetadata])

The new way (using an options object for optional values):

new Processor(url, streamResolver, { maxWidth: 1024, density: 600 })

Additional changes:

mbklein commented 3 years ago

And after all that, I forgot my own admonition and merged without squashing. Ah well.