@@ -159,2 +159,3 @@ // Copyright 2013 Lovell Fuller and others. | ||
| * @param {string|Object} [options.pdfBackground] - Background colour to use when PDF is partially transparent. Parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick. | ||
| * @param {boolean} [options.jp2Oneshot=false] - Set to `true` to decode tiled JPEG 2000 images in a single operation, improving compatibility. | ||
| * @param {boolean} [options.animated=false] - Set to `true` to read all frames/pages of an animated image (GIF, WebP, TIFF), equivalent of setting `pages` to `-1`. | ||
@@ -161,0 +162,0 @@ * @param {Object} [options.raw] - describes raw pixel input image data. See `raw()` for pixel ordering. |
+11
-3
@@ -30,5 +30,5 @@ // Copyright 2013 Lovell Fuller and others. | ||
| 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; | ||
@@ -254,2 +254,10 @@ } | ||
| } | ||
| // 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 | ||
@@ -256,0 +264,0 @@ if (is.defined(inputOptions.create)) { |
+34
-39
| { | ||
| "name": "sharp", | ||
| "description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images", | ||
| "version": "0.34.2", | ||
| "version": "0.34.3-rc.0", | ||
| "author": "Lovell Fuller <npm@lovell.info>", | ||
@@ -95,3 +95,3 @@ "homepage": "https://sharp.pixelplumbing.com", | ||
| "scripts": { | ||
| "install": "node install/check", | ||
| "install": "node install/check.js", | ||
| "clean": "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*", | ||
@@ -104,4 +104,3 @@ "test": "npm run test-lint && npm run test-unit && npm run test-licensing && npm run test-types", | ||
| "test-types": "tsd", | ||
| "package-from-local-build": "node npm/from-local-build", | ||
| "package-from-github-release": "node npm/from-github-release", | ||
| "package-from-local-build": "node npm/from-local-build.js", | ||
| "docs-build": "node docs/build.mjs", | ||
@@ -147,31 +146,32 @@ "docs-serve": "cd docs && npm start", | ||
| "optionalDependencies": { | ||
| "@img/sharp-darwin-arm64": "0.34.2", | ||
| "@img/sharp-darwin-x64": "0.34.2", | ||
| "@img/sharp-libvips-darwin-arm64": "1.1.0", | ||
| "@img/sharp-libvips-darwin-x64": "1.1.0", | ||
| "@img/sharp-libvips-linux-arm": "1.1.0", | ||
| "@img/sharp-libvips-linux-arm64": "1.1.0", | ||
| "@img/sharp-libvips-linux-ppc64": "1.1.0", | ||
| "@img/sharp-libvips-linux-s390x": "1.1.0", | ||
| "@img/sharp-libvips-linux-x64": "1.1.0", | ||
| "@img/sharp-libvips-linuxmusl-arm64": "1.1.0", | ||
| "@img/sharp-libvips-linuxmusl-x64": "1.1.0", | ||
| "@img/sharp-linux-arm": "0.34.2", | ||
| "@img/sharp-linux-arm64": "0.34.2", | ||
| "@img/sharp-linux-s390x": "0.34.2", | ||
| "@img/sharp-linux-x64": "0.34.2", | ||
| "@img/sharp-linuxmusl-arm64": "0.34.2", | ||
| "@img/sharp-linuxmusl-x64": "0.34.2", | ||
| "@img/sharp-wasm32": "0.34.2", | ||
| "@img/sharp-win32-arm64": "0.34.2", | ||
| "@img/sharp-win32-ia32": "0.34.2", | ||
| "@img/sharp-win32-x64": "0.34.2" | ||
| "@img/sharp-darwin-arm64": "0.34.3-rc.0", | ||
| "@img/sharp-darwin-x64": "0.34.3-rc.0", | ||
| "@img/sharp-libvips-darwin-arm64": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-darwin-x64": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-linux-arm": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-linux-arm64": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-linux-ppc64": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-linux-s390x": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-linux-x64": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-linuxmusl-arm64": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-linuxmusl-x64": "1.2.0-rc.2", | ||
| "@img/sharp-linux-arm": "0.34.3-rc.0", | ||
| "@img/sharp-linux-arm64": "0.34.3-rc.0", | ||
| "@img/sharp-linux-ppc64": "0.34.3-rc.0", | ||
| "@img/sharp-linux-s390x": "0.34.3-rc.0", | ||
| "@img/sharp-linux-x64": "0.34.3-rc.0", | ||
| "@img/sharp-linuxmusl-arm64": "0.34.3-rc.0", | ||
| "@img/sharp-linuxmusl-x64": "0.34.3-rc.0", | ||
| "@img/sharp-wasm32": "0.34.3-rc.0", | ||
| "@img/sharp-win32-arm64": "0.34.3-rc.0", | ||
| "@img/sharp-win32-ia32": "0.34.3-rc.0", | ||
| "@img/sharp-win32-x64": "0.34.3-rc.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@emnapi/runtime": "^1.4.3", | ||
| "@img/sharp-libvips-dev": "1.1.0", | ||
| "@img/sharp-libvips-dev-wasm32": "1.1.0", | ||
| "@img/sharp-libvips-win32-arm64": "1.1.0", | ||
| "@img/sharp-libvips-win32-ia32": "1.1.0", | ||
| "@img/sharp-libvips-win32-x64": "1.1.0", | ||
| "@img/sharp-libvips-dev": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-dev-wasm32": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-win32-arm64": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-win32-ia32": "1.2.0-rc.2", | ||
| "@img/sharp-libvips-win32-x64": "1.2.0-rc.2", | ||
| "@types/node": "*", | ||
@@ -185,8 +185,8 @@ "cc": "^3.0.1", | ||
| "license-checker": "^25.0.1", | ||
| "mocha": "^11.4.0", | ||
| "mocha": "^11.6.0", | ||
| "node-addon-api": "^8.3.1", | ||
| "node-gyp": "^11.2.0", | ||
| "nyc": "^17.1.0", | ||
| "prebuild": "^13.0.1", | ||
| "semistandard": "^17.0.0", | ||
| "tar-fs": "^3.0.8", | ||
| "tar-fs": "^3.0.9", | ||
| "tsd": "^0.32.0" | ||
@@ -199,3 +199,3 @@ }, | ||
| "config": { | ||
| "libvips": ">=8.16.1" | ||
| "libvips": ">=8.17.0" | ||
| }, | ||
@@ -205,7 +205,2 @@ "funding": { | ||
| }, | ||
| "binary": { | ||
| "napi_versions": [ | ||
| 9 | ||
| ] | ||
| }, | ||
| "semistandard": { | ||
@@ -212,0 +207,0 @@ "env": [ |
+10
-0
@@ -116,2 +116,6 @@ // Copyright 2013 Lovell Fuller and others. | ||
| } | ||
| // Use JPEG 2000 oneshot mode? | ||
| if (HasAttr(input, "jp2Oneshot")) { | ||
| descriptor->jp2Oneshot = AttrAsBool(input, "jp2Oneshot"); | ||
| } | ||
| // Create new image | ||
@@ -438,2 +442,5 @@ if (HasAttr(input, "createChannels")) { | ||
| } | ||
| if (imageType == ImageType::JP2) { | ||
| option->set("oneshot", descriptor->jp2Oneshot); | ||
| } | ||
| image = VImage::new_from_buffer(descriptor->buffer, descriptor->bufferLength, nullptr, option); | ||
@@ -546,2 +553,5 @@ if (imageType == ImageType::SVG || imageType == ImageType::PDF || imageType == ImageType::MAGICK) { | ||
| } | ||
| if (imageType == ImageType::JP2) { | ||
| option->set("oneshot", descriptor->jp2Oneshot); | ||
| } | ||
| image = VImage::new_from_file(descriptor->file.data(), option); | ||
@@ -548,0 +558,0 @@ if (imageType == ImageType::SVG || imageType == ImageType::PDF || imageType == ImageType::MAGICK) { |
+6
-4
@@ -18,5 +18,5 @@ // Copyright 2013 Lovell Fuller and others. | ||
| #if (VIPS_MAJOR_VERSION < 8) || \ | ||
| (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 16) || \ | ||
| (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 16 && VIPS_MICRO_VERSION < 1) | ||
| #error "libvips version 8.16.1+ is required - please see https://sharp.pixelplumbing.com/install" | ||
| (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 17) || \ | ||
| (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 17 && VIPS_MICRO_VERSION < 0) | ||
| #error "libvips version 8.17.0+ is required - please see https://sharp.pixelplumbing.com/install" | ||
| #endif | ||
@@ -82,2 +82,3 @@ | ||
| std::vector<double> pdfBackground; | ||
| bool jp2Oneshot; | ||
@@ -125,3 +126,4 @@ InputDescriptor(): | ||
| joinValign(VIPS_ALIGN_LOW), | ||
| pdfBackground{ 255.0, 255.0, 255.0, 255.0 } {} | ||
| pdfBackground{ 255.0, 255.0, 255.0, 255.0 }, | ||
| jp2Oneshot(false) {} | ||
| }; | ||
@@ -128,0 +130,0 @@ |
+4
-2
@@ -21,4 +21,6 @@ // Copyright 2013 Lovell Fuller and others. | ||
| g_log_set_handler("VIPS", static_cast<GLogLevelFlags>(G_LOG_LEVEL_WARNING), | ||
| static_cast<GLogFunc>(sharp::VipsWarningCallback), nullptr); | ||
| for (auto domain : { "VIPS", "vips2tiff" }) { | ||
| g_log_set_handler(domain, static_cast<GLogLevelFlags>(G_LOG_LEVEL_WARNING), | ||
| static_cast<GLogFunc>(sharp::VipsWarningCallback), nullptr); | ||
| } | ||
@@ -25,0 +27,0 @@ // Methods available to JavaScript |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Install scripts
Supply chain riskInstall scripts are run when the package is installed or built. Malicious packages often use scripts that run automatically to execute payloads or fetch additional code.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Install scripts
Supply chain riskInstall scripts are run when the package is installed or built. Malicious packages often use scripts that run automatically to execute payloads or fetch additional code.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
523902
0.27%7361
0.15%25
4.17%