mirror of
https://github.com/lovell/sharp.git
synced 2026-02-15 19:06:17 +01:00
Compare commits
13 Commits
v0.33.5-rc
...
1533bf995a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1533bf995a | ||
|
|
a53d7cb6bf | ||
|
|
b249357732 | ||
|
|
807d9241bd | ||
|
|
9bfaca2857 | ||
|
|
c26b77683a | ||
|
|
7ee54810d4 | ||
|
|
fc32e0bd3f | ||
|
|
0546e48467 | ||
|
|
ab65b7a0f1 | ||
|
|
2474bd4163 | ||
|
|
ff2e689d35 | ||
|
|
6327f13717 |
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
@@ -144,6 +144,13 @@ jobs:
|
|||||||
nodejs_hostname: nodejs.org
|
nodejs_hostname: nodejs.org
|
||||||
nodejs_version: "18.17.0"
|
nodejs_version: "18.17.0"
|
||||||
nodejs_version_major: 18
|
nodejs_version_major: 18
|
||||||
|
- platform: linux-ppc64
|
||||||
|
distro: bullseye
|
||||||
|
run_on_arch: ppc64le
|
||||||
|
nodejs_arch: ppc64le
|
||||||
|
nodejs_hostname: nodejs.org
|
||||||
|
nodejs_version: "18.17.0"
|
||||||
|
nodejs_version_major: 18
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: uraimo/run-on-arch-action@v2
|
- uses: uraimo/run-on-arch-action@v2
|
||||||
@@ -171,7 +178,7 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
name: wasm32 - prebuild
|
name: wasm32 - prebuild
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
container: "emscripten/emsdk:3.1.64"
|
container: "emscripten/emsdk:3.1.68"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
26
.github/workflows/npm.yml
vendored
26
.github/workflows/npm.yml
vendored
@@ -31,6 +31,10 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
runtime: node
|
runtime: node
|
||||||
package-manager: yarn-pnp
|
package-manager: yarn-pnp
|
||||||
|
- name: linux-x64-node-yarn-v1
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn-v1
|
||||||
- name: linux-x64-deno
|
- name: linux-x64-deno
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
runtime: deno
|
runtime: deno
|
||||||
@@ -54,6 +58,10 @@ jobs:
|
|||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
runtime: node
|
runtime: node
|
||||||
package-manager: yarn-pnp
|
package-manager: yarn-pnp
|
||||||
|
- name: darwin-x64-node-yarn-v1
|
||||||
|
runs-on: macos-12
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn-v1
|
||||||
- name: darwin-x64-deno
|
- name: darwin-x64-deno
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
runtime: deno
|
runtime: deno
|
||||||
@@ -77,6 +85,10 @@ jobs:
|
|||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
runtime: node
|
runtime: node
|
||||||
package-manager: yarn-pnp
|
package-manager: yarn-pnp
|
||||||
|
- name: win32-x64-node-yarn-v1
|
||||||
|
runs-on: windows-2019
|
||||||
|
runtime: node
|
||||||
|
package-manager: yarn-v1
|
||||||
- name: win32-x64-deno
|
- name: win32-x64-deno
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
runtime: deno
|
runtime: deno
|
||||||
@@ -89,7 +101,7 @@ jobs:
|
|||||||
node-version: 20
|
node-version: 20
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
if: ${{ matrix.package-manager == 'pnpm' }}
|
if: ${{ matrix.package-manager == 'pnpm' }}
|
||||||
uses: pnpm/action-setup@v2
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: 8
|
||||||
- name: Install Deno
|
- name: Install Deno
|
||||||
@@ -99,13 +111,13 @@ jobs:
|
|||||||
deno-version: v1.x
|
deno-version: v1.x
|
||||||
- name: Install Bun
|
- name: Install Bun
|
||||||
if: ${{ matrix.runtime == 'bun' }}
|
if: ${{ matrix.runtime == 'bun' }}
|
||||||
uses: oven-sh/setup-bun@v1
|
uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
|
|
||||||
- name: Version
|
- name: Version
|
||||||
id: version
|
id: version
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setOutput('semver', context.ref.replace('refs/tags/v',''))
|
core.setOutput('semver', context.ref.replace('refs/tags/v',''))
|
||||||
@@ -163,6 +175,14 @@ jobs:
|
|||||||
yarn install
|
yarn install
|
||||||
yarn node release.mjs
|
yarn node release.mjs
|
||||||
|
|
||||||
|
- name: Run with Node.js + yarn v1
|
||||||
|
if: ${{ matrix.package-manager == 'yarn-v1' }}
|
||||||
|
run: |
|
||||||
|
corepack enable
|
||||||
|
yarn set version classic
|
||||||
|
yarn install
|
||||||
|
node release.mjs
|
||||||
|
|
||||||
- name: Run with Deno
|
- name: Run with Deno
|
||||||
if: ${{ matrix.runtime == 'deno' }}
|
if: ${{ matrix.runtime == 'deno' }}
|
||||||
run: deno run --allow-read --allow-ffi release.mjs
|
run: deno run --allow-read --allow-ffi release.mjs
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ const output = await sharp(input)
|
|||||||
|
|
||||||
Convert to 8-bit greyscale; 256 shades of grey.
|
Convert to 8-bit greyscale; 256 shades of grey.
|
||||||
This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
|
This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
|
||||||
By default the output image will be web-friendly sRGB and contain three (identical) color channels.
|
By default the output image will be web-friendly sRGB and contain three (identical) colour channels.
|
||||||
This may be overridden by other sharp operations such as `toColourspace('b-w')`,
|
This may be overridden by other sharp operations such as `toColourspace('b-w')`,
|
||||||
which will produce an output image containing one color channel.
|
which will produce an output image containing one colour channel.
|
||||||
An alpha channel may be present, and will be unchanged by the operation.
|
An alpha channel may be present, and will be unchanged by the operation.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ where the overall height is the `pageHeight` multiplied by the number of `pages`
|
|||||||
| [options.page] | <code>number</code> | <code>0</code> | Page number to start extracting from for multi-page input (GIF, WebP, TIFF), zero based. |
|
| [options.page] | <code>number</code> | <code>0</code> | Page number to start extracting from for multi-page input (GIF, WebP, TIFF), zero based. |
|
||||||
| [options.subifd] | <code>number</code> | <code>-1</code> | subIFD (Sub Image File Directory) to extract for OME-TIFF, defaults to main image. |
|
| [options.subifd] | <code>number</code> | <code>-1</code> | subIFD (Sub Image File Directory) to extract for OME-TIFF, defaults to main image. |
|
||||||
| [options.level] | <code>number</code> | <code>0</code> | level to extract from a multi-level input (OpenSlide), zero based. |
|
| [options.level] | <code>number</code> | <code>0</code> | level to extract from a multi-level input (OpenSlide), zero based. |
|
||||||
|
| [options.pdfBackground] | <code>string</code> \| <code>Object</code> | | 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. |
|
||||||
| [options.animated] | <code>boolean</code> | <code>false</code> | Set to `true` to read all frames/pages of an animated image (GIF, WebP, TIFF), equivalent of setting `pages` to `-1`. |
|
| [options.animated] | <code>boolean</code> | <code>false</code> | Set to `true` to read all frames/pages of an animated image (GIF, WebP, TIFF), equivalent of setting `pages` to `-1`. |
|
||||||
| [options.raw] | <code>Object</code> | | describes raw pixel input image data. See `raw()` for pixel ordering. |
|
| [options.raw] | <code>Object</code> | | describes raw pixel input image data. See `raw()` for pixel ordering. |
|
||||||
| [options.raw.width] | <code>number</code> | | integral number of pixels wide. |
|
| [options.raw.width] | <code>number</code> | | integral number of pixels wide. |
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ const output = await sharp(input).flop().toBuffer();
|
|||||||
Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
||||||
|
|
||||||
You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
||||||
By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
|
By default, new pixels are filled with a black background. You can provide a background colour with the `background` option.
|
||||||
A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
||||||
|
|
||||||
In the case of a 2x2 matrix, the transform is:
|
In the case of a 2x2 matrix, the transform is:
|
||||||
|
|||||||
@@ -2,9 +2,25 @@
|
|||||||
|
|
||||||
## v0.33 - *gauge*
|
## v0.33 - *gauge*
|
||||||
|
|
||||||
Requires libvips v8.15.3
|
Requires libvips v8.15.5-rc1
|
||||||
|
|
||||||
### v0.33.5 - TBD
|
### v0.33.6 - TBD
|
||||||
|
|
||||||
|
* Upgrade to libvips v8.15.5-rc1 for upstream bug fixes.
|
||||||
|
|
||||||
|
* TypeScript: Ensure channel counts use the correct range.
|
||||||
|
[#4197](https://github.com/lovell/sharp/pull/4197)
|
||||||
|
[@DavidVaness](https://github.com/DavidVaness)
|
||||||
|
|
||||||
|
* Improve support for ppc64le architecture.
|
||||||
|
[#4203](https://github.com/lovell/sharp/pull/4203)
|
||||||
|
[@sumitd2](https://github.com/sumitd2)
|
||||||
|
|
||||||
|
* Add `pdfBackground` constructor property.
|
||||||
|
[#4207](https://github.com/lovell/sharp/pull/4207)
|
||||||
|
[@calebmer](https://github.com/calebmer)
|
||||||
|
|
||||||
|
### v0.33.5 - 16th August 2024
|
||||||
|
|
||||||
* Upgrade to libvips v8.15.3 for upstream bug fixes.
|
* Upgrade to libvips v8.15.3 for upstream bug fixes.
|
||||||
|
|
||||||
@@ -37,6 +53,10 @@ Requires libvips v8.15.3
|
|||||||
* Ensure `keepIccProfile` avoids colour transformation where possible.
|
* Ensure `keepIccProfile` avoids colour transformation where possible.
|
||||||
[#4186](https://github.com/lovell/sharp/issues/4186)
|
[#4186](https://github.com/lovell/sharp/issues/4186)
|
||||||
|
|
||||||
|
* TypeScript: `chromaSubsampling` metadata is optional.
|
||||||
|
[#4191](https://github.com/lovell/sharp/pull/4191)
|
||||||
|
[@DavidVaness](https://github.com/DavidVaness)
|
||||||
|
|
||||||
### v0.33.4 - 16th May 2024
|
### v0.33.4 - 16th May 2024
|
||||||
|
|
||||||
* Remove experimental status from `pipelineColourspace`.
|
* Remove experimental status from `pipelineColourspace`.
|
||||||
|
|||||||
@@ -302,3 +302,9 @@ GitHub: https://github.com/ton11797
|
|||||||
|
|
||||||
Name: Nathan Keynes
|
Name: Nathan Keynes
|
||||||
GitHub: https://github.com/nkeynes
|
GitHub: https://github.com/nkeynes
|
||||||
|
|
||||||
|
Name: Sumit D
|
||||||
|
GitHub: https://github.com/sumitd2
|
||||||
|
|
||||||
|
Name: Caleb Meredith
|
||||||
|
GitHub: https://github.com/calebmer
|
||||||
|
|||||||
@@ -20,11 +20,6 @@ pnpm add sharp
|
|||||||
yarn add sharp
|
yarn add sharp
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
|
||||||
# yarn v1 (maintenance mode)
|
|
||||||
yarn add sharp --ignore-engines
|
|
||||||
```
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
bun add sharp
|
bun add sharp
|
||||||
```
|
```
|
||||||
@@ -45,6 +40,7 @@ Ready-compiled sharp and libvips binaries are provided for use on the most commo
|
|||||||
* macOS ARM64
|
* macOS ARM64
|
||||||
* Linux ARM (glibc >= 2.28)
|
* Linux ARM (glibc >= 2.28)
|
||||||
* Linux ARM64 (glibc >= 2.26, musl >= 1.2.2)
|
* Linux ARM64 (glibc >= 2.26, musl >= 1.2.2)
|
||||||
|
* Linux ppc64 (glibc >= 2.31)
|
||||||
* Linux s390x (glibc >= 2.31)
|
* Linux s390x (glibc >= 2.31)
|
||||||
* Linux x64 (glibc >= 2.26, musl >= 1.2.2, CPU with SSE4.2)
|
* Linux x64 (glibc >= 2.26, musl >= 1.2.2, CPU with SSE4.2)
|
||||||
* Windows x64
|
* Windows x64
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -158,6 +158,7 @@ function bandbool (boolOp) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorate the Sharp prototype with channel-related functions.
|
* Decorate the Sharp prototype with channel-related functions.
|
||||||
|
* @module Sharp
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ function tint (tint) {
|
|||||||
/**
|
/**
|
||||||
* Convert to 8-bit greyscale; 256 shades of grey.
|
* Convert to 8-bit greyscale; 256 shades of grey.
|
||||||
* This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
|
* This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
|
||||||
* By default the output image will be web-friendly sRGB and contain three (identical) color channels.
|
* By default the output image will be web-friendly sRGB and contain three (identical) colour channels.
|
||||||
* This may be overridden by other sharp operations such as `toColourspace('b-w')`,
|
* This may be overridden by other sharp operations such as `toColourspace('b-w')`,
|
||||||
* which will produce an output image containing one color channel.
|
* which will produce an output image containing one colour channel.
|
||||||
* An alpha channel may be present, and will be unchanged by the operation.
|
* An alpha channel may be present, and will be unchanged by the operation.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
@@ -159,6 +159,7 @@ function _setBackgroundColourOption (key, value) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorate the Sharp prototype with colour-related functions.
|
* Decorate the Sharp prototype with colour-related functions.
|
||||||
|
* @module Sharp
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ function composite (images) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorate the Sharp prototype with composite-related functions.
|
* Decorate the Sharp prototype with composite-related functions.
|
||||||
|
* @module Sharp
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ const debuglog = util.debuglog('sharp');
|
|||||||
* @param {number} [options.page=0] - Page number to start extracting from for multi-page input (GIF, WebP, TIFF), zero based.
|
* @param {number} [options.page=0] - Page number to start extracting from for multi-page input (GIF, WebP, TIFF), zero based.
|
||||||
* @param {number} [options.subifd=-1] - subIFD (Sub Image File Directory) to extract for OME-TIFF, defaults to main image.
|
* @param {number} [options.subifd=-1] - subIFD (Sub Image File Directory) to extract for OME-TIFF, defaults to main image.
|
||||||
* @param {number} [options.level=0] - level to extract from a multi-level input (OpenSlide), zero based.
|
* @param {number} [options.level=0] - level to extract from a multi-level input (OpenSlide), zero based.
|
||||||
|
* @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.animated=false] - Set to `true` to read all frames/pages of an animated image (GIF, WebP, TIFF), equivalent of setting `pages` to `-1`.
|
* @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`.
|
||||||
* @param {Object} [options.raw] - describes raw pixel input image data. See `raw()` for pixel ordering.
|
* @param {Object} [options.raw] - describes raw pixel input image data. See `raw()` for pixel ordering.
|
||||||
* @param {number} [options.raw.width] - integral number of pixels wide.
|
* @param {number} [options.raw.width] - integral number of pixels wide.
|
||||||
@@ -348,6 +349,7 @@ const Sharp = function (input, options) {
|
|||||||
timeoutSeconds: 0,
|
timeoutSeconds: 0,
|
||||||
linearA: [],
|
linearA: [],
|
||||||
linearB: [],
|
linearB: [],
|
||||||
|
pdfBackground: [255, 255, 255, 255],
|
||||||
// Function to notify of libvips warnings
|
// Function to notify of libvips warnings
|
||||||
debuglog: warning => {
|
debuglog: warning => {
|
||||||
this.emit('warning', warning);
|
this.emit('warning', warning);
|
||||||
@@ -447,6 +449,7 @@ Object.assign(Sharp.prototype, { clone });
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Export constructor.
|
* Export constructor.
|
||||||
|
* @module Sharp
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = Sharp;
|
module.exports = Sharp;
|
||||||
|
|||||||
41
lib/index.d.ts
vendored
41
lib/index.d.ts
vendored
@@ -244,14 +244,14 @@ declare namespace sharp {
|
|||||||
* @param tint Parsed by the color module.
|
* @param tint Parsed by the color module.
|
||||||
* @returns A sharp instance that can be used to chain operations
|
* @returns A sharp instance that can be used to chain operations
|
||||||
*/
|
*/
|
||||||
tint(tint: Color): Sharp;
|
tint(tint: Colour | Color): Sharp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert to 8-bit greyscale; 256 shades of grey.
|
* Convert to 8-bit greyscale; 256 shades of grey.
|
||||||
* This is a linear operation.
|
* This is a linear operation.
|
||||||
* If the input image is in a non-linear colour space such as sRGB, use gamma() with greyscale() for the best results.
|
* If the input image is in a non-linear colour space such as sRGB, use gamma() with greyscale() for the best results.
|
||||||
* By default the output image will be web-friendly sRGB and contain three (identical) color channels.
|
* By default the output image will be web-friendly sRGB and contain three (identical) colour channels.
|
||||||
* This may be overridden by other sharp operations such as toColourspace('b-w'), which will produce an output image containing one color channel.
|
* This may be overridden by other sharp operations such as toColourspace('b-w'), which will produce an output image containing one colour channel.
|
||||||
* An alpha channel may be present, and will be unchanged by the operation.
|
* An alpha channel may be present, and will be unchanged by the operation.
|
||||||
* @param greyscale true to enable and false to disable (defaults to true)
|
* @param greyscale true to enable and false to disable (defaults to true)
|
||||||
* @returns A sharp instance that can be used to chain operations
|
* @returns A sharp instance that can be used to chain operations
|
||||||
@@ -401,7 +401,7 @@ declare namespace sharp {
|
|||||||
/**
|
/**
|
||||||
* Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
* Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
||||||
* You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
* You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
||||||
* By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
|
* By default, new pixels are filled with a black background. You can provide a background colour with the `background` option.
|
||||||
* A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
* A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
||||||
*
|
*
|
||||||
* In the case of a 2x2 matrix, the transform is:
|
* In the case of a 2x2 matrix, the transform is:
|
||||||
@@ -935,6 +935,8 @@ declare namespace sharp {
|
|||||||
subifd?: number | undefined;
|
subifd?: number | undefined;
|
||||||
/** Level to extract from a multi-level input (OpenSlide), zero based. (optional, default 0) */
|
/** Level to extract from a multi-level input (OpenSlide), zero based. (optional, default 0) */
|
||||||
level?: number | undefined;
|
level?: number | undefined;
|
||||||
|
/** Background colour to use when PDF is partially transparent. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick. */
|
||||||
|
pdfBackground?: Colour | Color | undefined;
|
||||||
/** Set to `true` to read all frames/pages of an animated image (equivalent of setting `pages` to `-1`). (optional, default false) */
|
/** Set to `true` to read all frames/pages of an animated image (equivalent of setting `pages` to `-1`). (optional, default false) */
|
||||||
animated?: boolean | undefined;
|
animated?: boolean | undefined;
|
||||||
/** Describes raw pixel input image data. See raw() for pixel ordering. */
|
/** Describes raw pixel input image data. See raw() for pixel ordering. */
|
||||||
@@ -969,7 +971,7 @@ declare namespace sharp {
|
|||||||
interface Raw {
|
interface Raw {
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
channels: 1 | 2 | 3 | 4;
|
channels: Channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CreateRaw extends Raw {
|
interface CreateRaw extends Raw {
|
||||||
@@ -977,15 +979,17 @@ declare namespace sharp {
|
|||||||
premultiplied?: boolean | undefined;
|
premultiplied?: boolean | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CreateChannels = 3 | 4;
|
||||||
|
|
||||||
interface Create {
|
interface Create {
|
||||||
/** Number of pixels wide. */
|
/** Number of pixels wide. */
|
||||||
width: number;
|
width: number;
|
||||||
/** Number of pixels high. */
|
/** Number of pixels high. */
|
||||||
height: number;
|
height: number;
|
||||||
/** Number of bands e.g. 3 for RGB, 4 for RGBA */
|
/** Number of bands, 3 for RGB, 4 for RGBA */
|
||||||
channels: Channels;
|
channels: CreateChannels;
|
||||||
/** Parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. */
|
/** Parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. */
|
||||||
background: Color;
|
background: Colour | Color;
|
||||||
/** Describes a noise to be created. */
|
/** Describes a noise to be created. */
|
||||||
noise?: Noise | undefined;
|
noise?: Noise | undefined;
|
||||||
}
|
}
|
||||||
@@ -1069,7 +1073,7 @@ declare namespace sharp {
|
|||||||
/** Number of pixels per inch (DPI), if present */
|
/** Number of pixels per inch (DPI), if present */
|
||||||
density?: number | undefined;
|
density?: number | undefined;
|
||||||
/** String containing JPEG chroma subsampling, 4:2:0 or 4:4:4 for RGB, 4:2:0:4 or 4:4:4:4 for CMYK */
|
/** String containing JPEG chroma subsampling, 4:2:0 or 4:4:4 for RGB, 4:2:0:4 or 4:4:4:4 for CMYK */
|
||||||
chromaSubsampling: string;
|
chromaSubsampling?: string | undefined;
|
||||||
/** Boolean indicating whether the image is interlaced using a progressive scan */
|
/** Boolean indicating whether the image is interlaced using a progressive scan */
|
||||||
isProgressive?: boolean | undefined;
|
isProgressive?: boolean | undefined;
|
||||||
/** Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP */
|
/** Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP */
|
||||||
@@ -1339,7 +1343,7 @@ declare namespace sharp {
|
|||||||
|
|
||||||
interface RotateOptions {
|
interface RotateOptions {
|
||||||
/** parsed by the color module to extract values for red, green, blue and alpha. (optional, default "#000000") */
|
/** parsed by the color module to extract values for red, green, blue and alpha. (optional, default "#000000") */
|
||||||
background?: Color | undefined;
|
background?: Colour | Color | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Precision = 'integer' | 'float' | 'approximate';
|
type Precision = 'integer' | 'float' | 'approximate';
|
||||||
@@ -1355,7 +1359,7 @@ declare namespace sharp {
|
|||||||
|
|
||||||
interface FlattenOptions {
|
interface FlattenOptions {
|
||||||
/** background colour, parsed by the color module, defaults to black. (optional, default {r:0,g:0,b:0}) */
|
/** background colour, parsed by the color module, defaults to black. (optional, default {r:0,g:0,b:0}) */
|
||||||
background?: Color | undefined;
|
background?: Colour | Color | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NegateOptions {
|
interface NegateOptions {
|
||||||
@@ -1380,7 +1384,7 @@ declare namespace sharp {
|
|||||||
/** Position, gravity or strategy to use when fit is cover or contain. (optional, default 'centre') */
|
/** Position, gravity or strategy to use when fit is cover or contain. (optional, default 'centre') */
|
||||||
position?: number | string | undefined;
|
position?: number | string | undefined;
|
||||||
/** Background colour when using a fit of contain, parsed by the color module, defaults to black without transparency. (optional, default {r:0,g:0,b:0,alpha:1}) */
|
/** Background colour when using a fit of contain, parsed by the color module, defaults to black without transparency. (optional, default {r:0,g:0,b:0,alpha:1}) */
|
||||||
background?: Color | undefined;
|
background?: Colour | Color | undefined;
|
||||||
/** The kernel to use for image reduction. (optional, default 'lanczos3') */
|
/** The kernel to use for image reduction. (optional, default 'lanczos3') */
|
||||||
kernel?: keyof KernelEnum | undefined;
|
kernel?: keyof KernelEnum | undefined;
|
||||||
/** Do not enlarge if the width or height are already less than the specified dimensions, equivalent to GraphicsMagick's > geometry option. (optional, default false) */
|
/** Do not enlarge if the width or height are already less than the specified dimensions, equivalent to GraphicsMagick's > geometry option. (optional, default false) */
|
||||||
@@ -1423,14 +1427,14 @@ declare namespace sharp {
|
|||||||
/** single pixel count to right edge (optional, default 0) */
|
/** single pixel count to right edge (optional, default 0) */
|
||||||
right?: number | undefined;
|
right?: number | undefined;
|
||||||
/** background colour, parsed by the color module, defaults to black without transparency. (optional, default {r:0,g:0,b:0,alpha:1}) */
|
/** background colour, parsed by the color module, defaults to black without transparency. (optional, default {r:0,g:0,b:0,alpha:1}) */
|
||||||
background?: Color | undefined;
|
background?: Colour | Color | undefined;
|
||||||
/** how the extension is done, one of: "background", "copy", "repeat", "mirror" (optional, default `'background'`) */
|
/** how the extension is done, one of: "background", "copy", "repeat", "mirror" (optional, default `'background'`) */
|
||||||
extendWith?: ExtendWith | undefined;
|
extendWith?: ExtendWith | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TrimOptions {
|
interface TrimOptions {
|
||||||
/** Background colour, parsed by the color module, defaults to that of the top-left pixel. (optional) */
|
/** Background colour, parsed by the color module, defaults to that of the top-left pixel. (optional) */
|
||||||
background?: Color | undefined;
|
background?: Colour | Color | undefined;
|
||||||
/** Allowed difference from the above colour, a positive number. (optional, default 10) */
|
/** Allowed difference from the above colour, a positive number. (optional, default 10) */
|
||||||
threshold?: number | undefined;
|
threshold?: number | undefined;
|
||||||
/** Does the input more closely resemble line art (e.g. vector) rather than being photographic? (optional, default false) */
|
/** Does the input more closely resemble line art (e.g. vector) rather than being photographic? (optional, default false) */
|
||||||
@@ -1441,8 +1445,8 @@ declare namespace sharp {
|
|||||||
depth?: 'char' | 'uchar' | 'short' | 'ushort' | 'int' | 'uint' | 'float' | 'complex' | 'double' | 'dpcomplex';
|
depth?: 'char' | 'uchar' | 'short' | 'ushort' | 'int' | 'uint' | 'float' | 'complex' | 'double' | 'dpcomplex';
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 3 for sRGB, 4 for CMYK */
|
/** 1 for grayscale, 2 for grayscale + alpha, 3 for sRGB, 4 for CMYK or RGBA */
|
||||||
type Channels = 3 | 4;
|
type Channels = 1 | 2 | 3 | 4;
|
||||||
|
|
||||||
interface RGBA {
|
interface RGBA {
|
||||||
r?: number | undefined;
|
r?: number | undefined;
|
||||||
@@ -1451,7 +1455,8 @@ declare namespace sharp {
|
|||||||
alpha?: number | undefined;
|
alpha?: number | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Color = string | RGBA;
|
type Colour = string | RGBA;
|
||||||
|
type Color = Colour;
|
||||||
|
|
||||||
interface Kernel {
|
interface Kernel {
|
||||||
/** width of the kernel in pixels. */
|
/** width of the kernel in pixels. */
|
||||||
@@ -1576,7 +1581,7 @@ declare namespace sharp {
|
|||||||
size: number;
|
size: number;
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
channels: 1 | 2 | 3 | 4;
|
channels: Channels;
|
||||||
/** indicating if premultiplication was used */
|
/** indicating if premultiplication was used */
|
||||||
premultiplied: boolean;
|
premultiplied: boolean;
|
||||||
/** Only defined when using a crop strategy */
|
/** Only defined when using a crop strategy */
|
||||||
|
|||||||
13
lib/input.js
13
lib/input.js
@@ -8,7 +8,7 @@ const is = require('./is');
|
|||||||
const sharp = require('./sharp');
|
const sharp = require('./sharp');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Justication alignment
|
* Justification alignment
|
||||||
* @member
|
* @member
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -24,9 +24,9 @@ const align = {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
function _inputOptionsFromObject (obj) {
|
function _inputOptionsFromObject (obj) {
|
||||||
const { raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd } = obj;
|
const { raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd, pdfBackground } = obj;
|
||||||
return [raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd].some(is.defined)
|
return [raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd, pdfBackground].some(is.defined)
|
||||||
? { raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd }
|
? { raw, density, limitInputPixels, ignoreIcc, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd, pdfBackground }
|
||||||
: undefined;
|
: undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,6 +222,10 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
|
|||||||
throw is.invalidParameterError('subifd', 'integer between -1 and 100000', inputOptions.subifd);
|
throw is.invalidParameterError('subifd', 'integer between -1 and 100000', inputOptions.subifd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// PDF background colour
|
||||||
|
if (is.defined(inputOptions.pdfBackground)) {
|
||||||
|
this._setBackgroundColourOption('pdfBackground', inputOptions.pdfBackground);
|
||||||
|
}
|
||||||
// Create new image
|
// Create new image
|
||||||
if (is.defined(inputOptions.create)) {
|
if (is.defined(inputOptions.create)) {
|
||||||
if (
|
if (
|
||||||
@@ -639,6 +643,7 @@ function stats (callback) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorate the Sharp prototype with input-related functions.
|
* Decorate the Sharp prototype with input-related functions.
|
||||||
|
* @module Sharp
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ function flop (flop) {
|
|||||||
* Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
* Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
||||||
*
|
*
|
||||||
* You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
* You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
||||||
* By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
|
* By default, new pixels are filled with a black background. You can provide a background colour with the `background` option.
|
||||||
* A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
* A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
||||||
*
|
*
|
||||||
* In the case of a 2x2 matrix, the transform is:
|
* In the case of a 2x2 matrix, the transform is:
|
||||||
@@ -930,6 +930,7 @@ function modulate (options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorate the Sharp prototype with operation-related functions.
|
* Decorate the Sharp prototype with operation-related functions.
|
||||||
|
* @module Sharp
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
|
|||||||
@@ -1551,6 +1551,7 @@ function _pipeline (callback, stack) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorate the Sharp prototype with output-related functions.
|
* Decorate the Sharp prototype with output-related functions.
|
||||||
|
* @module Sharp
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
|
|||||||
@@ -569,6 +569,7 @@ function trim (options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorate the Sharp prototype with resize-related functions.
|
* Decorate the Sharp prototype with resize-related functions.
|
||||||
|
* @module Sharp
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ if (sharp) {
|
|||||||
help.push(
|
help.push(
|
||||||
'- Ensure optional dependencies can be installed:',
|
'- Ensure optional dependencies can be installed:',
|
||||||
' npm install --include=optional sharp',
|
' npm install --include=optional sharp',
|
||||||
' yarn add sharp --ignore-engines',
|
|
||||||
'- Ensure your package manager supports multi-platform installation:',
|
'- Ensure your package manager supports multi-platform installation:',
|
||||||
' See https://sharp.pixelplumbing.com/install#cross-platform',
|
' See https://sharp.pixelplumbing.com/install#cross-platform',
|
||||||
'- Add platform-specific dependencies:',
|
'- Add platform-specific dependencies:',
|
||||||
|
|||||||
@@ -280,6 +280,7 @@ function unblock (options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorate the Sharp class with utility-related functions.
|
* Decorate the Sharp class with utility-related functions.
|
||||||
|
* @module Sharp
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
module.exports = function (Sharp) {
|
module.exports = function (Sharp) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-darwin-arm64",
|
"name": "@img/sharp-darwin-arm64",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with macOS 64-bit ARM",
|
"description": "Prebuilt sharp for use with macOS 64-bit ARM",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@img/sharp-libvips-darwin-arm64": "1.0.4"
|
"@img/sharp-libvips-darwin-arm64": "1.0.6"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-darwin-x64",
|
"name": "@img/sharp-darwin-x64",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with macOS x64",
|
"description": "Prebuilt sharp for use with macOS x64",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@img/sharp-libvips-darwin-x64": "1.0.4"
|
"@img/sharp-libvips-darwin-x64": "1.0.6"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linux-arm",
|
"name": "@img/sharp-linux-arm",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with Linux (glibc) ARM (32-bit)",
|
"description": "Prebuilt sharp for use with Linux (glibc) ARM (32-bit)",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@img/sharp-libvips-linux-arm": "1.0.5"
|
"@img/sharp-libvips-linux-arm": "1.0.6"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linux-arm64",
|
"name": "@img/sharp-linux-arm64",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with Linux (glibc) 64-bit ARM",
|
"description": "Prebuilt sharp for use with Linux (glibc) 64-bit ARM",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@img/sharp-libvips-linux-arm64": "1.0.4"
|
"@img/sharp-libvips-linux-arm64": "1.0.6"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
|
|||||||
46
npm/linux-ppc64/package.json
Normal file
46
npm/linux-ppc64/package.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "@img/sharp-linux-ppc64",
|
||||||
|
"version": "0.33.5",
|
||||||
|
"description": "Prebuilt sharp for use with Linux (glibc) ppc64",
|
||||||
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/lovell/sharp.git",
|
||||||
|
"directory": "npm/linux-ppc64"
|
||||||
|
},
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/libvips"
|
||||||
|
},
|
||||||
|
"preferUnplugged": true,
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@img/sharp-libvips-linux-ppc64": "1.0.6"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"type": "commonjs",
|
||||||
|
"exports": {
|
||||||
|
"./sharp.node": "./lib/sharp-linux-ppc64.node",
|
||||||
|
"./package": "./package.json"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"glibc": ">=2.31"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"ppc64"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linux-s390x",
|
"name": "@img/sharp-linux-s390x",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with Linux (glibc) s390x",
|
"description": "Prebuilt sharp for use with Linux (glibc) s390x",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@img/sharp-libvips-linux-s390x": "1.0.4"
|
"@img/sharp-libvips-linux-s390x": "1.0.6"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linux-x64",
|
"name": "@img/sharp-linux-x64",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with Linux (glibc) x64",
|
"description": "Prebuilt sharp for use with Linux (glibc) x64",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@img/sharp-libvips-linux-x64": "1.0.4"
|
"@img/sharp-libvips-linux-x64": "1.0.6"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linuxmusl-arm64",
|
"name": "@img/sharp-linuxmusl-arm64",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with Linux (musl) 64-bit ARM",
|
"description": "Prebuilt sharp for use with Linux (musl) 64-bit ARM",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@img/sharp-libvips-linuxmusl-arm64": "1.0.4"
|
"@img/sharp-libvips-linuxmusl-arm64": "1.0.6"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linuxmusl-x64",
|
"name": "@img/sharp-linuxmusl-x64",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with Linux (musl) x64",
|
"description": "Prebuilt sharp for use with Linux (musl) x64",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@img/sharp-libvips-linuxmusl-x64": "1.0.4"
|
"@img/sharp-libvips-linuxmusl-x64": "1.0.6"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp",
|
"name": "@img/sharp",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"darwin-arm64",
|
"darwin-arm64",
|
||||||
"darwin-x64",
|
"darwin-x64",
|
||||||
"linux-arm",
|
"linux-arm",
|
||||||
"linux-arm64",
|
"linux-arm64",
|
||||||
|
"linux-ppc64",
|
||||||
"linux-s390x",
|
"linux-s390x",
|
||||||
"linux-x64",
|
"linux-x64",
|
||||||
"linuxmusl-arm64",
|
"linuxmusl-arm64",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-wasm32",
|
"name": "@img/sharp-wasm32",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with wasm32",
|
"description": "Prebuilt sharp for use with wasm32",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-win32-ia32",
|
"name": "@img/sharp-win32-ia32",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with Windows x86 (32-bit)",
|
"description": "Prebuilt sharp for use with Windows x86 (32-bit)",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-win32-x64",
|
"name": "@img/sharp-win32-x64",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"description": "Prebuilt sharp for use with Windows x64",
|
"description": "Prebuilt sharp for use with Windows x64",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
|
|||||||
56
package.json
56
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "sharp",
|
"name": "sharp",
|
||||||
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
|
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
|
||||||
"version": "0.33.5-rc.0",
|
"version": "0.33.5",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
@@ -142,40 +142,40 @@
|
|||||||
"semver": "^7.6.3"
|
"semver": "^7.6.3"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@img/sharp-darwin-arm64": "0.33.5-rc.0",
|
"@img/sharp-darwin-arm64": "0.33.5",
|
||||||
"@img/sharp-darwin-x64": "0.33.5-rc.0",
|
"@img/sharp-darwin-x64": "0.33.5",
|
||||||
"@img/sharp-libvips-darwin-arm64": "1.0.4",
|
"@img/sharp-libvips-darwin-arm64": "1.0.6",
|
||||||
"@img/sharp-libvips-darwin-x64": "1.0.4",
|
"@img/sharp-libvips-darwin-x64": "1.0.6",
|
||||||
"@img/sharp-libvips-linux-arm": "1.0.5",
|
"@img/sharp-libvips-linux-arm": "1.0.6",
|
||||||
"@img/sharp-libvips-linux-arm64": "1.0.4",
|
"@img/sharp-libvips-linux-arm64": "1.0.6",
|
||||||
"@img/sharp-libvips-linux-s390x": "1.0.4",
|
"@img/sharp-libvips-linux-ppc64": "1.0.6",
|
||||||
"@img/sharp-libvips-linux-x64": "1.0.4",
|
"@img/sharp-libvips-linux-s390x": "1.0.6",
|
||||||
"@img/sharp-libvips-linuxmusl-arm64": "1.0.4",
|
"@img/sharp-libvips-linux-x64": "1.0.6",
|
||||||
"@img/sharp-libvips-linuxmusl-x64": "1.0.4",
|
"@img/sharp-libvips-linuxmusl-arm64": "1.0.6",
|
||||||
"@img/sharp-linux-arm": "0.33.5-rc.0",
|
"@img/sharp-libvips-linuxmusl-x64": "1.0.6",
|
||||||
"@img/sharp-linux-arm64": "0.33.5-rc.0",
|
"@img/sharp-linux-arm": "0.33.5",
|
||||||
"@img/sharp-linux-s390x": "0.33.5-rc.0",
|
"@img/sharp-linux-arm64": "0.33.5",
|
||||||
"@img/sharp-linux-x64": "0.33.5-rc.0",
|
"@img/sharp-linux-s390x": "0.33.5",
|
||||||
"@img/sharp-linuxmusl-arm64": "0.33.5-rc.0",
|
"@img/sharp-linux-x64": "0.33.5",
|
||||||
"@img/sharp-linuxmusl-x64": "0.33.5-rc.0",
|
"@img/sharp-linuxmusl-arm64": "0.33.5",
|
||||||
"@img/sharp-wasm32": "0.33.5-rc.0",
|
"@img/sharp-linuxmusl-x64": "0.33.5",
|
||||||
"@img/sharp-win32-ia32": "0.33.5-rc.0",
|
"@img/sharp-wasm32": "0.33.5",
|
||||||
"@img/sharp-win32-x64": "0.33.5-rc.0"
|
"@img/sharp-win32-ia32": "0.33.5",
|
||||||
|
"@img/sharp-win32-x64": "0.33.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@emnapi/runtime": "^1.2.0",
|
"@emnapi/runtime": "^1.2.0",
|
||||||
"@img/sharp-libvips-dev": "1.0.4",
|
"@img/sharp-libvips-dev": "1.0.6",
|
||||||
"@img/sharp-libvips-dev-wasm32": "1.0.5",
|
"@img/sharp-libvips-dev-wasm32": "1.0.6",
|
||||||
"@img/sharp-libvips-win32-ia32": "1.0.4",
|
"@img/sharp-libvips-win32-ia32": "1.0.6",
|
||||||
"@img/sharp-libvips-win32-x64": "1.0.4",
|
"@img/sharp-libvips-win32-x64": "1.0.6",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"async": "^3.2.5",
|
|
||||||
"cc": "^3.0.1",
|
"cc": "^3.0.1",
|
||||||
"emnapi": "^1.2.0",
|
"emnapi": "^1.2.0",
|
||||||
"exif-reader": "^2.0.1",
|
"exif-reader": "^2.0.1",
|
||||||
"extract-zip": "^2.0.1",
|
"extract-zip": "^2.0.1",
|
||||||
"icc": "^3.0.0",
|
"icc": "^3.0.0",
|
||||||
"jsdoc-to-markdown": "^8.0.3",
|
"jsdoc-to-markdown": "^9.0.0",
|
||||||
"license-checker": "^25.0.1",
|
"license-checker": "^25.0.1",
|
||||||
"mocha": "^10.7.3",
|
"mocha": "^10.7.3",
|
||||||
"node-addon-api": "^8.1.0",
|
"node-addon-api": "^8.1.0",
|
||||||
@@ -183,14 +183,14 @@
|
|||||||
"prebuild": "^13.0.1",
|
"prebuild": "^13.0.1",
|
||||||
"semistandard": "^17.0.0",
|
"semistandard": "^17.0.0",
|
||||||
"tar-fs": "^3.0.6",
|
"tar-fs": "^3.0.6",
|
||||||
"tsd": "^0.31.1"
|
"tsd": "^0.31.2"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"libvips": ">=8.15.3"
|
"libvips": ">=8.15.5"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/libvips"
|
"url": "https://opencollective.com/libvips"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
'sharp_libvips_lib_dir': '<!(node -p "require(\'../lib/libvips\').buildSharpLibvipsLibDir()")'
|
'sharp_libvips_lib_dir': '<!(node -p "require(\'../lib/libvips\').buildSharpLibvipsLibDir()")'
|
||||||
},
|
},
|
||||||
'targets': [{
|
'targets': [{
|
||||||
'target_name': 'libvips-cpp',
|
'target_name': 'libvips-cpp-<(vips_version)',
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['OS == "win"', {
|
['OS == "win"', {
|
||||||
# Build libvips C++ binding for Windows due to MSVC std library ABI changes
|
# Build libvips C++ binding for Windows due to MSVC std library ABI changes
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
],
|
],
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'<!(node -p "require(\'node-addon-api\').gyp")',
|
'<!(node -p "require(\'node-addon-api\').gyp")',
|
||||||
'libvips-cpp'
|
'libvips-cpp-<(vips_version)'
|
||||||
],
|
],
|
||||||
'variables': {
|
'variables': {
|
||||||
'conditions': [
|
'conditions': [
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
['OS == "mac"', {
|
['OS == "mac"', {
|
||||||
'link_settings': {
|
'link_settings': {
|
||||||
'libraries': [
|
'libraries': [
|
||||||
'libvips-cpp.42.dylib'
|
'libvips-cpp.<(vips_version).dylib'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'xcode_settings': {
|
'xcode_settings': {
|
||||||
@@ -169,7 +169,7 @@
|
|||||||
],
|
],
|
||||||
'link_settings': {
|
'link_settings': {
|
||||||
'libraries': [
|
'libraries': [
|
||||||
'-l:libvips-cpp.so.42'
|
'-l:libvips-cpp.so.<(vips_version)'
|
||||||
],
|
],
|
||||||
'ldflags': [
|
'ldflags': [
|
||||||
'-Wl,-s',
|
'-Wl,-s',
|
||||||
|
|||||||
@@ -109,6 +109,10 @@ namespace sharp {
|
|||||||
if (HasAttr(input, "subifd")) {
|
if (HasAttr(input, "subifd")) {
|
||||||
descriptor->subifd = AttrAsInt32(input, "subifd");
|
descriptor->subifd = AttrAsInt32(input, "subifd");
|
||||||
}
|
}
|
||||||
|
// // PDF background color
|
||||||
|
if (HasAttr(input, "pdfBackground")) {
|
||||||
|
descriptor->pdfBackground = AttrAsVectorOfDouble(input, "pdfBackground");
|
||||||
|
}
|
||||||
// Create new image
|
// Create new image
|
||||||
if (HasAttr(input, "createChannels")) {
|
if (HasAttr(input, "createChannels")) {
|
||||||
descriptor->createChannels = AttrAsUint32(input, "createChannels");
|
descriptor->createChannels = AttrAsUint32(input, "createChannels");
|
||||||
@@ -402,6 +406,9 @@ namespace sharp {
|
|||||||
if (imageType == ImageType::TIFF) {
|
if (imageType == ImageType::TIFF) {
|
||||||
option->set("subifd", descriptor->subifd);
|
option->set("subifd", descriptor->subifd);
|
||||||
}
|
}
|
||||||
|
if (imageType == ImageType::PDF) {
|
||||||
|
option->set("background", descriptor->pdfBackground);
|
||||||
|
}
|
||||||
image = VImage::new_from_buffer(descriptor->buffer, descriptor->bufferLength, nullptr, option);
|
image = VImage::new_from_buffer(descriptor->buffer, descriptor->bufferLength, nullptr, option);
|
||||||
if (imageType == ImageType::SVG || imageType == ImageType::PDF || imageType == ImageType::MAGICK) {
|
if (imageType == ImageType::SVG || imageType == ImageType::PDF || imageType == ImageType::MAGICK) {
|
||||||
image = SetDensity(image, descriptor->density);
|
image = SetDensity(image, descriptor->density);
|
||||||
@@ -506,6 +513,9 @@ namespace sharp {
|
|||||||
if (imageType == ImageType::TIFF) {
|
if (imageType == ImageType::TIFF) {
|
||||||
option->set("subifd", descriptor->subifd);
|
option->set("subifd", descriptor->subifd);
|
||||||
}
|
}
|
||||||
|
if (imageType == ImageType::PDF) {
|
||||||
|
option->set("background", descriptor->pdfBackground);
|
||||||
|
}
|
||||||
image = VImage::new_from_file(descriptor->file.data(), option);
|
image = VImage::new_from_file(descriptor->file.data(), option);
|
||||||
if (imageType == ImageType::SVG || imageType == ImageType::PDF || imageType == ImageType::MAGICK) {
|
if (imageType == ImageType::SVG || imageType == ImageType::PDF || imageType == ImageType::MAGICK) {
|
||||||
image = SetDensity(image, descriptor->density);
|
image = SetDensity(image, descriptor->density);
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
#if (VIPS_MAJOR_VERSION < 8) || \
|
#if (VIPS_MAJOR_VERSION < 8) || \
|
||||||
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 15) || \
|
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 15) || \
|
||||||
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 15 && VIPS_MICRO_VERSION < 3)
|
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 15 && VIPS_MICRO_VERSION < 5)
|
||||||
#error "libvips version 8.15.3+ is required - please see https://sharp.pixelplumbing.com/install"
|
#error "libvips version 8.15.5+ is required - please see https://sharp.pixelplumbing.com/install"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
|
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
|
||||||
@@ -74,6 +74,7 @@ namespace sharp {
|
|||||||
int textSpacing;
|
int textSpacing;
|
||||||
VipsTextWrap textWrap;
|
VipsTextWrap textWrap;
|
||||||
int textAutofitDpi;
|
int textAutofitDpi;
|
||||||
|
std::vector<double> pdfBackground;
|
||||||
|
|
||||||
InputDescriptor():
|
InputDescriptor():
|
||||||
buffer(nullptr),
|
buffer(nullptr),
|
||||||
@@ -108,7 +109,8 @@ namespace sharp {
|
|||||||
textRgba(false),
|
textRgba(false),
|
||||||
textSpacing(0),
|
textSpacing(0),
|
||||||
textWrap(VIPS_TEXT_WRAP_WORD),
|
textWrap(VIPS_TEXT_WRAP_WORD),
|
||||||
textAutofitDpi(0) {}
|
textAutofitDpi(0),
|
||||||
|
pdfBackground{ 255.0, 255.0, 255.0, 255.0 } {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convenience methods to access the attributes of a Napi::Object
|
// Convenience methods to access the attributes of a Napi::Object
|
||||||
|
|||||||
@@ -714,3 +714,8 @@ sharp(input).composite([
|
|||||||
failOn: "truncated"
|
failOn: "truncated"
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const colour: sharp.Colour = '#fff';
|
||||||
|
const color: sharp.Color = '#fff';
|
||||||
|
sharp({ pdfBackground: colour });
|
||||||
|
sharp({ pdfBackground: color });
|
||||||
|
|||||||
@@ -893,6 +893,27 @@ describe('Input/output', function () {
|
|||||||
sharp({ subifd: 1.2 });
|
sharp({ subifd: 1.2 });
|
||||||
}, /Expected integer between -1 and 100000 for subifd but received 1.2 of type number/);
|
}, /Expected integer between -1 and 100000 for subifd but received 1.2 of type number/);
|
||||||
});
|
});
|
||||||
|
it('Valid pdfBackground property (string)', function () {
|
||||||
|
sharp({ pdfBackground: '#00ff00' });
|
||||||
|
});
|
||||||
|
it('Valid pdfBackground property (object)', function () {
|
||||||
|
sharp({ pdfBackground: { r: 0, g: 255, b: 0 } });
|
||||||
|
});
|
||||||
|
it('Invalid pdfBackground property (string) throws', function () {
|
||||||
|
assert.throws(function () {
|
||||||
|
sharp({ pdfBackground: '00ff00' });
|
||||||
|
}, /Unable to parse color from string/);
|
||||||
|
});
|
||||||
|
it('Invalid pdfBackground property (number) throws', function () {
|
||||||
|
assert.throws(function () {
|
||||||
|
sharp({ pdfBackground: 255 });
|
||||||
|
}, /Expected object or string for background/);
|
||||||
|
});
|
||||||
|
it('Invalid pdfBackground property (object)', function () {
|
||||||
|
assert.throws(function () {
|
||||||
|
sharp({ pdfBackground: { red: 0, green: 255, blue: 0 } });
|
||||||
|
}, /Unable to parse color from object/);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Fails when writing to missing directory', async () => {
|
it('Fails when writing to missing directory', async () => {
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ describe('libvips binaries', function () {
|
|||||||
});
|
});
|
||||||
it('arch', () => {
|
it('arch', () => {
|
||||||
const [, arch] = libvips.runtimePlatformArch().split('-');
|
const [, arch] = libvips.runtimePlatformArch().split('-');
|
||||||
assert.strict(['arm', 'arm64', 'ia32', 'x64'].includes(arch));
|
assert.strict(['arm', 'arm64', 'ia32', 'x64', 'ppc64'].includes(arch));
|
||||||
});
|
});
|
||||||
it('isUnsupportedNodeRuntime', () => {
|
it('isUnsupportedNodeRuntime', () => {
|
||||||
assert.strictEqual(libvips.isUnsupportedNodeRuntime(), undefined);
|
assert.strictEqual(libvips.isUnsupportedNodeRuntime(), undefined);
|
||||||
@@ -179,7 +179,7 @@ describe('libvips binaries', function () {
|
|||||||
process.env.npm_config_arch = 's390x';
|
process.env.npm_config_arch = 's390x';
|
||||||
process.env.npm_config_libc = '';
|
process.env.npm_config_libc = '';
|
||||||
const locatorHash = libvips.yarnLocator();
|
const locatorHash = libvips.yarnLocator();
|
||||||
assert.strictEqual(locatorHash, 'c4ea54fdc1');
|
assert.strictEqual(locatorHash, 'b9c917c310');
|
||||||
delete process.env.npm_config_platform;
|
delete process.env.npm_config_platform;
|
||||||
delete process.env.npm_config_arch;
|
delete process.env.npm_config_arch;
|
||||||
delete process.env.npm_config_libc;
|
delete process.env.npm_config_libc;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
const eachLimit = require('async/eachLimit');
|
|
||||||
const extractZip = require('extract-zip');
|
const extractZip = require('extract-zip');
|
||||||
|
|
||||||
const sharp = require('../../');
|
const sharp = require('../../');
|
||||||
@@ -31,11 +30,10 @@ const assertDeepZoomTiles = function (directory, expectedSize, expectedLevels, d
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
// Verify each tile is <= expectedSize
|
// Verify each tile is <= expectedSize
|
||||||
eachLimit(tiles, 8, function (tile, done) {
|
Promise.all(tiles.map(function (tile) {
|
||||||
sharp(tile).metadata(function (err, metadata) {
|
return sharp(tile)
|
||||||
if (err) {
|
.metadata()
|
||||||
done(err);
|
.then(function (metadata) {
|
||||||
} else {
|
|
||||||
assert.strictEqual('jpeg', metadata.format);
|
assert.strictEqual('jpeg', metadata.format);
|
||||||
assert.strictEqual('srgb', metadata.space);
|
assert.strictEqual('srgb', metadata.space);
|
||||||
assert.strictEqual(3, metadata.channels);
|
assert.strictEqual(3, metadata.channels);
|
||||||
@@ -43,10 +41,10 @@ const assertDeepZoomTiles = function (directory, expectedSize, expectedLevels, d
|
|||||||
assert.strictEqual(false, metadata.hasAlpha);
|
assert.strictEqual(false, metadata.hasAlpha);
|
||||||
assert.strictEqual(true, metadata.width <= expectedSize);
|
assert.strictEqual(true, metadata.width <= expectedSize);
|
||||||
assert.strictEqual(true, metadata.height <= expectedSize);
|
assert.strictEqual(true, metadata.height <= expectedSize);
|
||||||
done();
|
});
|
||||||
}
|
}))
|
||||||
});
|
.then(() => done())
|
||||||
}, done);
|
.catch(done);
|
||||||
};
|
};
|
||||||
|
|
||||||
const assertZoomifyTiles = function (directory, expectedTileSize, expectedLevels, done) {
|
const assertZoomifyTiles = function (directory, expectedTileSize, expectedLevels, done) {
|
||||||
|
|||||||
Reference in New Issue
Block a user