mirror of
https://github.com/lovell/sharp.git
synced 2025-12-06 12:01:41 +01:00
Compare commits
No commits in common. "main" and "v0.34.5-rc.0" have entirely different histories.
main
...
v0.34.5-rc
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: v0.34.5 - 6th November 2025
|
title: v0.34.5 - TBD
|
||||||
slug: changelog/v0.34.5
|
slug: changelog/v0.34.5
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
21
lib/index.d.ts
vendored
21
lib/index.d.ts
vendored
@ -860,7 +860,6 @@ declare namespace sharp {
|
|||||||
| JxlOptions
|
| JxlOptions
|
||||||
| GifOptions
|
| GifOptions
|
||||||
| Jp2Options
|
| Jp2Options
|
||||||
| RawOptions
|
|
||||||
| TiffOptions,
|
| TiffOptions,
|
||||||
): Sharp;
|
): Sharp;
|
||||||
|
|
||||||
@ -1028,11 +1027,11 @@ declare namespace sharp {
|
|||||||
openSlide?: OpenSlideInputOptions | undefined;
|
openSlide?: OpenSlideInputOptions | undefined;
|
||||||
/** JPEG 2000 specific input options */
|
/** JPEG 2000 specific input options */
|
||||||
jp2?: Jp2InputOptions | undefined;
|
jp2?: Jp2InputOptions | undefined;
|
||||||
/** @deprecated Use {@link SharpOptions.tiff} instead */
|
/** Deprecated: use tiff.subifd instead */
|
||||||
subifd?: number | undefined;
|
subifd?: number | undefined;
|
||||||
/** @deprecated Use {@link SharpOptions.pdf} instead */
|
/** Deprecated: use pdf.background instead */
|
||||||
pdfBackground?: Colour | Color | undefined;
|
pdfBackground?: Colour | Color | undefined;
|
||||||
/** @deprecated Use {@link SharpOptions.openSlide} instead */
|
/** Deprecated: use openSlide.level instead */
|
||||||
level?: number | undefined;
|
level?: number | 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;
|
||||||
@ -1182,10 +1181,6 @@ declare namespace sharp {
|
|||||||
'IFD3'?: ExifDir;
|
'IFD3'?: ExifDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
type HeifCompression = 'av1' | 'hevc';
|
|
||||||
|
|
||||||
type Unit = 'inch' | 'cm';
|
|
||||||
|
|
||||||
interface WriteableMetadata {
|
interface WriteableMetadata {
|
||||||
/** Number of pixels per inch (DPI) */
|
/** Number of pixels per inch (DPI) */
|
||||||
density?: number | undefined;
|
density?: number | undefined;
|
||||||
@ -1264,7 +1259,7 @@ declare namespace sharp {
|
|||||||
/** Buffer containing raw TIFFTAG_PHOTOSHOP data, if present */
|
/** Buffer containing raw TIFFTAG_PHOTOSHOP data, if present */
|
||||||
tifftagPhotoshop?: Buffer | undefined;
|
tifftagPhotoshop?: Buffer | undefined;
|
||||||
/** The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC) */
|
/** The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC) */
|
||||||
compression?: HeifCompression | undefined;
|
compression?: 'av1' | 'hevc';
|
||||||
/** Default background colour, if present, for PNG (bKGD) and GIF images */
|
/** Default background colour, if present, for PNG (bKGD) and GIF images */
|
||||||
background?: { r: number; g: number; b: number } | { gray: number };
|
background?: { r: number; g: number; b: number } | { gray: number };
|
||||||
/** Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide */
|
/** Details of each level in a multi-level image provided as an array of objects, requires libvips compiled with support for OpenSlide */
|
||||||
@ -1272,7 +1267,7 @@ declare namespace sharp {
|
|||||||
/** Number of Sub Image File Directories in an OME-TIFF image */
|
/** Number of Sub Image File Directories in an OME-TIFF image */
|
||||||
subifds?: number | undefined;
|
subifds?: number | undefined;
|
||||||
/** The unit of resolution (density) */
|
/** The unit of resolution (density) */
|
||||||
resolutionUnit?: Unit | undefined;
|
resolutionUnit?: 'inch' | 'cm' | undefined;
|
||||||
/** String containing format for images loaded via *magick */
|
/** String containing format for images loaded via *magick */
|
||||||
formatMagick?: string | undefined;
|
formatMagick?: string | undefined;
|
||||||
/** Array of keyword/text pairs representing PNG text blocks, if present. */
|
/** Array of keyword/text pairs representing PNG text blocks, if present. */
|
||||||
@ -1428,7 +1423,7 @@ declare namespace sharp {
|
|||||||
/** quality, integer 1-100 (optional, default 50) */
|
/** quality, integer 1-100 (optional, default 50) */
|
||||||
quality?: number | undefined;
|
quality?: number | undefined;
|
||||||
/** compression format: av1, hevc (optional, default 'av1') */
|
/** compression format: av1, hevc (optional, default 'av1') */
|
||||||
compression?: HeifCompression | undefined;
|
compression?: 'av1' | 'hevc' | undefined;
|
||||||
/** use lossless compression (optional, default false) */
|
/** use lossless compression (optional, default false) */
|
||||||
lossless?: boolean | undefined;
|
lossless?: boolean | undefined;
|
||||||
/** Level of CPU effort to reduce file size, between 0 (fastest) and 9 (slowest) (optional, default 4) */
|
/** Level of CPU effort to reduce file size, between 0 (fastest) and 9 (slowest) (optional, default 4) */
|
||||||
@ -1486,7 +1481,7 @@ declare namespace sharp {
|
|||||||
/** Write 1-bit images as miniswhite (optional, default false) */
|
/** Write 1-bit images as miniswhite (optional, default false) */
|
||||||
miniswhite?: boolean | undefined;
|
miniswhite?: boolean | undefined;
|
||||||
/** Resolution unit options: inch, cm (optional, default 'inch') */
|
/** Resolution unit options: inch, cm (optional, default 'inch') */
|
||||||
resolutionUnit?: Unit | undefined;
|
resolutionUnit?: 'inch' | 'cm' | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PngOptions extends OutputOptions {
|
interface PngOptions extends OutputOptions {
|
||||||
@ -1611,7 +1606,7 @@ declare namespace sharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface RawOptions {
|
interface RawOptions {
|
||||||
depth?: keyof DepthEnum;
|
depth?: 'char' | 'uchar' | 'short' | 'ushort' | 'int' | 'uint' | 'float' | 'complex' | 'double' | 'dpcomplex';
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 1 for grayscale, 2 for grayscale + alpha, 3 for sRGB, 4 for CMYK or RGBA */
|
/** 1 for grayscale, 2 for grayscale + alpha, 3 for sRGB, 4 for CMYK or RGBA */
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-darwin-arm64",
|
"name": "@img/sharp-darwin-arm64",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-darwin-x64",
|
"name": "@img/sharp-darwin-x64",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linux-arm",
|
"name": "@img/sharp-linux-arm",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linux-arm64",
|
"name": "@img/sharp-linux-arm64",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linux-ppc64",
|
"name": "@img/sharp-linux-ppc64",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"description": "Prebuilt sharp for use with Linux (glibc) ppc64",
|
"description": "Prebuilt sharp for use with Linux (glibc) ppc64",
|
||||||
"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-linux-riscv64",
|
"name": "@img/sharp-linux-riscv64",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"description": "Prebuilt sharp for use with Linux (glibc) RISC-V 64-bit",
|
"description": "Prebuilt sharp for use with Linux (glibc) RISC-V 64-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-linux-s390x",
|
"name": "@img/sharp-linux-s390x",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linux-x64",
|
"name": "@img/sharp-linux-x64",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linuxmusl-arm64",
|
"name": "@img/sharp-linuxmusl-arm64",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-linuxmusl-x64",
|
"name": "@img/sharp-linuxmusl-x64",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp",
|
"name": "@img/sharp",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"darwin-arm64",
|
"darwin-arm64",
|
||||||
@ -8,7 +8,6 @@
|
|||||||
"linux-arm",
|
"linux-arm",
|
||||||
"linux-arm64",
|
"linux-arm64",
|
||||||
"linux-ppc64",
|
"linux-ppc64",
|
||||||
"linux-riscv64",
|
|
||||||
"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.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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-arm64",
|
"name": "@img/sharp-win32-arm64",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"description": "Prebuilt sharp for use with Windows 64-bit ARM",
|
"description": "Prebuilt sharp for use with Windows 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",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@img/sharp-win32-ia32",
|
"name": "@img/sharp-win32-ia32",
|
||||||
"version": "0.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"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",
|
||||||
|
|||||||
36
package.json
36
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.34.5",
|
"version": "0.34.5-rc.0",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"homepage": "https://sharp.pixelplumbing.com",
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
@ -144,8 +144,8 @@
|
|||||||
"semver": "^7.7.3"
|
"semver": "^7.7.3"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@img/sharp-darwin-arm64": "0.34.5",
|
"@img/sharp-darwin-arm64": "0.34.5-rc.0",
|
||||||
"@img/sharp-darwin-x64": "0.34.5",
|
"@img/sharp-darwin-x64": "0.34.5-rc.0",
|
||||||
"@img/sharp-libvips-darwin-arm64": "1.2.4",
|
"@img/sharp-libvips-darwin-arm64": "1.2.4",
|
||||||
"@img/sharp-libvips-darwin-x64": "1.2.4",
|
"@img/sharp-libvips-darwin-x64": "1.2.4",
|
||||||
"@img/sharp-libvips-linux-arm": "1.2.4",
|
"@img/sharp-libvips-linux-arm": "1.2.4",
|
||||||
@ -156,18 +156,18 @@
|
|||||||
"@img/sharp-libvips-linux-x64": "1.2.4",
|
"@img/sharp-libvips-linux-x64": "1.2.4",
|
||||||
"@img/sharp-libvips-linuxmusl-arm64": "1.2.4",
|
"@img/sharp-libvips-linuxmusl-arm64": "1.2.4",
|
||||||
"@img/sharp-libvips-linuxmusl-x64": "1.2.4",
|
"@img/sharp-libvips-linuxmusl-x64": "1.2.4",
|
||||||
"@img/sharp-linux-arm": "0.34.5",
|
"@img/sharp-linux-arm": "0.34.5-rc.0",
|
||||||
"@img/sharp-linux-arm64": "0.34.5",
|
"@img/sharp-linux-arm64": "0.34.5-rc.0",
|
||||||
"@img/sharp-linux-ppc64": "0.34.5",
|
"@img/sharp-linux-ppc64": "0.34.5-rc.0",
|
||||||
"@img/sharp-linux-riscv64": "0.34.5",
|
"@img/sharp-linux-riscv64": "0.34.5-rc.0",
|
||||||
"@img/sharp-linux-s390x": "0.34.5",
|
"@img/sharp-linux-s390x": "0.34.5-rc.0",
|
||||||
"@img/sharp-linux-x64": "0.34.5",
|
"@img/sharp-linux-x64": "0.34.5-rc.0",
|
||||||
"@img/sharp-linuxmusl-arm64": "0.34.5",
|
"@img/sharp-linuxmusl-arm64": "0.34.5-rc.0",
|
||||||
"@img/sharp-linuxmusl-x64": "0.34.5",
|
"@img/sharp-linuxmusl-x64": "0.34.5-rc.0",
|
||||||
"@img/sharp-wasm32": "0.34.5",
|
"@img/sharp-wasm32": "0.34.5-rc.0",
|
||||||
"@img/sharp-win32-arm64": "0.34.5",
|
"@img/sharp-win32-arm64": "0.34.5-rc.0",
|
||||||
"@img/sharp-win32-ia32": "0.34.5",
|
"@img/sharp-win32-ia32": "0.34.5-rc.0",
|
||||||
"@img/sharp-win32-x64": "0.34.5"
|
"@img/sharp-win32-x64": "0.34.5-rc.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^2.3.4",
|
"@biomejs/biome": "^2.3.4",
|
||||||
@ -198,5 +198,11 @@
|
|||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/libvips"
|
"url": "https://opencollective.com/libvips"
|
||||||
|
},
|
||||||
|
"cc": {
|
||||||
|
"linelength": "120",
|
||||||
|
"filter": [
|
||||||
|
"build/include"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,7 +120,7 @@
|
|||||||
'conditions': [
|
'conditions': [
|
||||||
['use_global_libvips == "true"', {
|
['use_global_libvips == "true"', {
|
||||||
# Use pkg-config for include and lib
|
# Use pkg-config for include and lib
|
||||||
'include_dirs': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --cflags-only-I vips-cpp vips glib-2.0 | sed s/-I//g)'],
|
'include_dirs': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --cflags-only-I vips-cpp vips glib-2.0 | sed s\/-I//g)'],
|
||||||
'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips-cpp)'],
|
'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips-cpp)'],
|
||||||
'defines': [
|
'defines': [
|
||||||
'SHARP_USE_GLOBAL_LIBVIPS'
|
'SHARP_USE_GLOBAL_LIBVIPS'
|
||||||
|
|||||||
@ -321,7 +321,7 @@ sharp('input.gif')
|
|||||||
// From https://sharp.pixelplumbing.com/api-output#examples-9
|
// From https://sharp.pixelplumbing.com/api-output#examples-9
|
||||||
// Extract raw RGB pixel data from JPEG input
|
// Extract raw RGB pixel data from JPEG input
|
||||||
sharp('input.jpg')
|
sharp('input.jpg')
|
||||||
.raw({ depth: 'ushort' })
|
.raw()
|
||||||
.toBuffer({ resolveWithObject: true })
|
.toBuffer({ resolveWithObject: true })
|
||||||
.then(({ data, info }) => {
|
.then(({ data, info }) => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|||||||
@ -45,11 +45,11 @@ describe('JP2 output', () => {
|
|||||||
assert.strictEqual('png', info.format);
|
assert.strictEqual('png', info.format);
|
||||||
assert.strictEqual(8, info.width);
|
assert.strictEqual(8, info.width);
|
||||||
assert.strictEqual(15, info.height);
|
assert.strictEqual(15, info.height);
|
||||||
assert.strictEqual(3, info.channels);
|
assert.strictEqual(4, info.channels);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('JP2 quality', (_t, done) => {
|
it('JP2 quality', (done) => {
|
||||||
sharp(fixtures.inputJp2)
|
sharp(fixtures.inputJp2)
|
||||||
.resize(320, 240)
|
.resize(320, 240)
|
||||||
.jp2({ quality: 70 })
|
.jp2({ quality: 70 })
|
||||||
@ -65,7 +65,7 @@ describe('JP2 output', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Without chroma subsampling generates larger file', (_t, done) => {
|
it('Without chroma subsampling generates larger file', (done) => {
|
||||||
// First generate with chroma subsampling (default)
|
// First generate with chroma subsampling (default)
|
||||||
sharp(fixtures.inputJp2)
|
sharp(fixtures.inputJp2)
|
||||||
.resize(320, 240)
|
.resize(320, 240)
|
||||||
@ -111,7 +111,7 @@ describe('JP2 output', () => {
|
|||||||
it('Invalid JP2 chromaSubsampling value throws error', () => {
|
it('Invalid JP2 chromaSubsampling value throws error', () => {
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => sharp().jp2({ chromaSubsampling: '4:2:2' }),
|
() => sharp().jp2({ chromaSubsampling: '4:2:2' }),
|
||||||
/Expected one of: 4:2:0, 4:4:4 for chromaSubsampling but received 4:2:2 of type string/
|
/Expected one of 4:2:0, 4:4:4 but received 4:2:2 of type string/
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user