mirror of
https://github.com/lovell/sharp.git
synced 2025-12-18 23:05:04 +01:00
Expose JPEG 2000 oneshot decoder option #4262
Requires libvips compiled with support for JP2 images Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
This commit is contained in:
committed by
Lovell Fuller
parent
01f6cbbaee
commit
751f9992c4
14
lib/input.js
14
lib/input.js
@@ -27,9 +27,9 @@ const align = {
|
||||
* @private
|
||||
*/
|
||||
function _inputOptionsFromObject (obj) {
|
||||
const { raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd, pdfBackground, autoOrient } = obj;
|
||||
return [raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd, pdfBackground, autoOrient].some(is.defined)
|
||||
? { raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd, pdfBackground, autoOrient }
|
||||
const { raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd, pdfBackground, autoOrient, jp2Oneshot } = obj;
|
||||
return [raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd, pdfBackground, autoOrient, jp2Oneshot].some(is.defined)
|
||||
? { raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd, pdfBackground, autoOrient, jp2Oneshot }
|
||||
: undefined;
|
||||
}
|
||||
|
||||
@@ -250,6 +250,14 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
|
||||
if (is.defined(inputOptions.pdfBackground)) {
|
||||
inputDescriptor.pdfBackground = this._getBackgroundColourOption(inputOptions.pdfBackground);
|
||||
}
|
||||
// JP2 oneshot
|
||||
if (is.defined(inputOptions.jp2Oneshot)) {
|
||||
if (is.bool(inputOptions.jp2Oneshot)) {
|
||||
inputDescriptor.jp2Oneshot = inputOptions.jp2Oneshot;
|
||||
} else {
|
||||
throw is.invalidParameterError('jp2Oneshot', 'boolean', inputOptions.jp2Oneshot);
|
||||
}
|
||||
}
|
||||
// Create new image
|
||||
if (is.defined(inputOptions.create)) {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user