Compare commits

..

2 Commits

Author SHA1 Message Date
Lovell Fuller
99be893dd4 Upgrade to libvips v8.17.0
CI: Use more recent, non-deprecated Windows runners

Bump devDeps
2025-06-12 11:27:26 +01:00
Kleis Auke Wolthuizen
4d1f7e051d
Support composite op with non-sRGB pipeline colourspace (#4412) 2025-06-12 10:32:24 +01:00
19 changed files with 82 additions and 49 deletions

View File

@ -78,34 +78,34 @@ jobs:
nodejs_version: "^22.9.0" nodejs_version: "^22.9.0"
nodejs_version_major: 22 nodejs_version_major: 22
platform: darwin-arm64 platform: darwin-arm64
- os: windows-2019 - os: windows-2022
nodejs_arch: x86 nodejs_arch: x86
nodejs_version: "18.18.2" # pinned to avoid 18.19.0 and npm 10 nodejs_version: "18.18.2" # pinned to avoid 18.19.0 and npm 10
nodejs_version_major: 18 nodejs_version_major: 18
platform: win32-ia32 platform: win32-ia32
prebuild: true prebuild: true
- os: windows-2019 - os: windows-2022
nodejs_arch: x86 nodejs_arch: x86
nodejs_version: "^20.3.0" nodejs_version: "^20.3.0"
nodejs_version_major: 20 nodejs_version_major: 20
platform: win32-ia32 platform: win32-ia32
- os: windows-2019 - os: windows-2022
nodejs_arch: x86 nodejs_arch: x86
nodejs_version: "^22.9.0" nodejs_version: "^22.9.0"
nodejs_version_major: 22 nodejs_version_major: 22
platform: win32-ia32 platform: win32-ia32
- os: windows-2019 - os: windows-2022
nodejs_arch: x64 nodejs_arch: x64
nodejs_version: "^18.17.0" nodejs_version: "^18.17.0"
nodejs_version_major: 18 nodejs_version_major: 18
platform: win32-x64 platform: win32-x64
prebuild: true prebuild: true
- os: windows-2019 - os: windows-2022
nodejs_arch: x64 nodejs_arch: x64
nodejs_version: "^20.3.0" nodejs_version: "^20.3.0"
nodejs_version_major: 20 nodejs_version_major: 20
platform: win32-x64 platform: win32-x64
- os: windows-2019 - os: windows-2022
nodejs_arch: x64 nodejs_arch: x64
nodejs_version: "^22.9.0" nodejs_version: "^22.9.0"
nodejs_version_major: 22 nodejs_version_major: 22

View File

@ -70,27 +70,27 @@ jobs:
runtime: bun runtime: bun
- name: win32-x64-node-npm - name: win32-x64-node-npm
runs-on: windows-2019 runs-on: windows-2022
runtime: node runtime: node
package-manager: npm package-manager: npm
- name: win32-x64-node-pnpm - name: win32-x64-node-pnpm
runs-on: windows-2019 runs-on: windows-2022
runtime: node runtime: node
package-manager: pnpm package-manager: pnpm
- name: win32-x64-node-yarn - name: win32-x64-node-yarn
runs-on: windows-2019 runs-on: windows-2022
runtime: node runtime: node
package-manager: yarn package-manager: yarn
- name: win32-x64-node-yarn-pnp - name: win32-x64-node-yarn-pnp
runs-on: windows-2019 runs-on: windows-2022
runtime: node runtime: node
package-manager: yarn-pnp package-manager: yarn-pnp
- name: win32-x64-node-yarn-v1 - name: win32-x64-node-yarn-v1
runs-on: windows-2019 runs-on: windows-2022
runtime: node runtime: node
package-manager: yarn-v1 package-manager: yarn-v1
- name: win32-x64-deno - name: win32-x64-deno
runs-on: windows-2019 runs-on: windows-2022
runtime: deno runtime: deno
steps: steps:

View File

@ -4,7 +4,15 @@ title: Changelog
## v0.34 - *hat* ## v0.34 - *hat*
Requires libvips v8.16.1 Requires libvips v8.17.0
### v0.34.3 - TBD
* Upgrade to libvips v8.17.0 for upstream bug fixes.
* Support composite operation with non-sRGB pipeline colourspace.
[#4412](https://github.com/lovell/sharp/pull/4412)
[@kleisauke](https://github.com/kleisauke)
### v0.34.2 - 20th May 2025 ### v0.34.2 - 20th May 2025

View File

@ -15,7 +15,7 @@
}, },
"preferUnplugged": true, "preferUnplugged": true,
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-libvips-darwin-arm64": "1.1.0" "@img/sharp-libvips-darwin-arm64": "1.2.0-rc.1"
}, },
"files": [ "files": [
"lib" "lib"

View File

@ -15,7 +15,7 @@
}, },
"preferUnplugged": true, "preferUnplugged": true,
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-libvips-darwin-x64": "1.1.0" "@img/sharp-libvips-darwin-x64": "1.2.0-rc.1"
}, },
"files": [ "files": [
"lib" "lib"

View File

@ -15,7 +15,7 @@
}, },
"preferUnplugged": true, "preferUnplugged": true,
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-libvips-linux-arm": "1.1.0" "@img/sharp-libvips-linux-arm": "1.2.0-rc.1"
}, },
"files": [ "files": [
"lib" "lib"

View File

@ -15,7 +15,7 @@
}, },
"preferUnplugged": true, "preferUnplugged": true,
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-libvips-linux-arm64": "1.1.0" "@img/sharp-libvips-linux-arm64": "1.2.0-rc.1"
}, },
"files": [ "files": [
"lib" "lib"

View File

@ -15,7 +15,7 @@
}, },
"preferUnplugged": true, "preferUnplugged": true,
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-libvips-linux-ppc64": "1.1.0" "@img/sharp-libvips-linux-ppc64": "1.2.0-rc.1"
}, },
"files": [ "files": [
"lib" "lib"

View File

@ -15,7 +15,7 @@
}, },
"preferUnplugged": true, "preferUnplugged": true,
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-libvips-linux-s390x": "1.1.0" "@img/sharp-libvips-linux-s390x": "1.2.0-rc.1"
}, },
"files": [ "files": [
"lib" "lib"

View File

@ -15,7 +15,7 @@
}, },
"preferUnplugged": true, "preferUnplugged": true,
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-libvips-linux-x64": "1.1.0" "@img/sharp-libvips-linux-x64": "1.2.0-rc.1"
}, },
"files": [ "files": [
"lib" "lib"

View File

@ -15,7 +15,7 @@
}, },
"preferUnplugged": true, "preferUnplugged": true,
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-libvips-linuxmusl-arm64": "1.1.0" "@img/sharp-libvips-linuxmusl-arm64": "1.2.0-rc.1"
}, },
"files": [ "files": [
"lib" "lib"

View File

@ -15,7 +15,7 @@
}, },
"preferUnplugged": true, "preferUnplugged": true,
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-libvips-linuxmusl-x64": "1.1.0" "@img/sharp-libvips-linuxmusl-x64": "1.2.0-rc.1"
}, },
"files": [ "files": [
"lib" "lib"

View File

@ -144,15 +144,15 @@
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-darwin-arm64": "0.34.2", "@img/sharp-darwin-arm64": "0.34.2",
"@img/sharp-darwin-x64": "0.34.2", "@img/sharp-darwin-x64": "0.34.2",
"@img/sharp-libvips-darwin-arm64": "1.1.0", "@img/sharp-libvips-darwin-arm64": "1.2.0-rc.1",
"@img/sharp-libvips-darwin-x64": "1.1.0", "@img/sharp-libvips-darwin-x64": "1.2.0-rc.1",
"@img/sharp-libvips-linux-arm": "1.1.0", "@img/sharp-libvips-linux-arm": "1.2.0-rc.1",
"@img/sharp-libvips-linux-arm64": "1.1.0", "@img/sharp-libvips-linux-arm64": "1.2.0-rc.1",
"@img/sharp-libvips-linux-ppc64": "1.1.0", "@img/sharp-libvips-linux-ppc64": "1.2.0-rc.1",
"@img/sharp-libvips-linux-s390x": "1.1.0", "@img/sharp-libvips-linux-s390x": "1.2.0-rc.1",
"@img/sharp-libvips-linux-x64": "1.1.0", "@img/sharp-libvips-linux-x64": "1.2.0-rc.1",
"@img/sharp-libvips-linuxmusl-arm64": "1.1.0", "@img/sharp-libvips-linuxmusl-arm64": "1.2.0-rc.1",
"@img/sharp-libvips-linuxmusl-x64": "1.1.0", "@img/sharp-libvips-linuxmusl-x64": "1.2.0-rc.1",
"@img/sharp-linux-arm": "0.34.2", "@img/sharp-linux-arm": "0.34.2",
"@img/sharp-linux-arm64": "0.34.2", "@img/sharp-linux-arm64": "0.34.2",
"@img/sharp-linux-s390x": "0.34.2", "@img/sharp-linux-s390x": "0.34.2",
@ -166,11 +166,11 @@
}, },
"devDependencies": { "devDependencies": {
"@emnapi/runtime": "^1.4.3", "@emnapi/runtime": "^1.4.3",
"@img/sharp-libvips-dev": "1.1.0", "@img/sharp-libvips-dev": "1.2.0-rc.1",
"@img/sharp-libvips-dev-wasm32": "1.1.0", "@img/sharp-libvips-dev-wasm32": "1.2.0-rc.1",
"@img/sharp-libvips-win32-arm64": "1.1.0", "@img/sharp-libvips-win32-arm64": "1.2.0-rc.1",
"@img/sharp-libvips-win32-ia32": "1.1.0", "@img/sharp-libvips-win32-ia32": "1.2.0-rc.1",
"@img/sharp-libvips-win32-x64": "1.1.0", "@img/sharp-libvips-win32-x64": "1.2.0-rc.1",
"@types/node": "*", "@types/node": "*",
"cc": "^3.0.1", "cc": "^3.0.1",
"emnapi": "^1.4.3", "emnapi": "^1.4.3",
@ -179,12 +179,12 @@
"icc": "^3.0.0", "icc": "^3.0.0",
"jsdoc-to-markdown": "^9.1.1", "jsdoc-to-markdown": "^9.1.1",
"license-checker": "^25.0.1", "license-checker": "^25.0.1",
"mocha": "^11.4.0", "mocha": "^11.6.0",
"node-addon-api": "^8.3.1", "node-addon-api": "^8.3.1",
"nyc": "^17.1.0", "nyc": "^17.1.0",
"prebuild": "^13.0.1", "prebuild": "^13.0.1",
"semistandard": "^17.0.0", "semistandard": "^17.0.0",
"tar-fs": "^3.0.8", "tar-fs": "^3.0.9",
"tsd": "^0.32.0" "tsd": "^0.32.0"
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
@ -192,7 +192,7 @@
"node": "^18.17.0 || ^20.3.0 || >=21.0.0" "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
}, },
"config": { "config": {
"libvips": ">=8.16.1" "libvips": ">=8.17.0"
}, },
"funding": { "funding": {
"url": "https://opencollective.com/libvips" "url": "https://opencollective.com/libvips"

View File

@ -15,9 +15,9 @@
// Verify platform and compiler compatibility // Verify platform and compiler compatibility
#if (VIPS_MAJOR_VERSION < 8) || \ #if (VIPS_MAJOR_VERSION < 8) || \
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 16) || \ (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 17) || \
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 16 && VIPS_MICRO_VERSION < 1) (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 17 && VIPS_MICRO_VERSION < 0)
#error "libvips version 8.16.1+ is required - please see https://sharp.pixelplumbing.com/install" #error "libvips version 8.17.0+ is required - please see https://sharp.pixelplumbing.com/install"
#endif #endif
#if defined(__has_include) #if defined(__has_include)

View File

@ -669,7 +669,6 @@ class PipelineWorker : public Napi::AsyncWorker {
sharp::ImageType compositeImageType = sharp::ImageType::UNKNOWN; sharp::ImageType compositeImageType = sharp::ImageType::UNKNOWN;
composite->input->access = access; composite->input->access = access;
std::tie(compositeImage, compositeImageType) = sharp::OpenInput(composite->input); std::tie(compositeImage, compositeImageType) = sharp::OpenInput(composite->input);
compositeImage = sharp::EnsureColourspace(compositeImage, baton->colourspacePipeline);
if (composite->input->autoOrient) { if (composite->input->autoOrient) {
// Respect EXIF Orientation // Respect EXIF Orientation
@ -734,8 +733,7 @@ class PipelineWorker : public Napi::AsyncWorker {
// gravity was used for extract_area, set it back to its default value of 0 // gravity was used for extract_area, set it back to its default value of 0
composite->gravity = 0; composite->gravity = 0;
} }
// Ensure image to composite is sRGB with unpremultiplied alpha // Ensure image to composite is with unpremultiplied alpha
compositeImage = compositeImage.colourspace(VIPS_INTERPRETATION_sRGB);
compositeImage = sharp::EnsureAlpha(compositeImage, 1); compositeImage = sharp::EnsureAlpha(compositeImage, 1);
if (composite->premultiplied) compositeImage = compositeImage.unpremultiply(); if (composite->premultiplied) compositeImage = compositeImage.unpremultiply();
// Calculate position // Calculate position
@ -760,7 +758,12 @@ class PipelineWorker : public Napi::AsyncWorker {
xs.push_back(left); xs.push_back(left);
ys.push_back(top); ys.push_back(top);
} }
image = VImage::composite(images, modes, VImage::option()->set("x", xs)->set("y", ys)); image = VImage::composite(images, modes, VImage::option()
->set("compositing_space", baton->colourspacePipeline == VIPS_INTERPRETATION_LAST
? VIPS_INTERPRETATION_sRGB
: baton->colourspacePipeline)
->set("x", xs)
->set("y", ys));
image = sharp::RemoveGifPalette(image); image = sharp::RemoveGifPalette(image);
} }

View File

@ -18,8 +18,10 @@ Napi::Object init(Napi::Env env, Napi::Object exports) {
vips_init("sharp"); vips_init("sharp");
}); });
g_log_set_handler("VIPS", static_cast<GLogLevelFlags>(G_LOG_LEVEL_WARNING), for (auto domain : { "VIPS", "vips2tiff" }) {
static_cast<GLogFunc>(sharp::VipsWarningCallback), nullptr); g_log_set_handler(domain, static_cast<GLogLevelFlags>(G_LOG_LEVEL_WARNING),
static_cast<GLogFunc>(sharp::VipsWarningCallback), nullptr);
}
// Methods available to JavaScript // Methods available to JavaScript
exports.Set("metadata", Napi::Function::New(env, metadata)); exports.Set("metadata", Napi::Function::New(env, metadata));

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -122,6 +122,26 @@ describe('composite', () => {
}); });
}); });
it('scrgb pipeline', () => {
const filename = 'composite-red-scrgb.png';
const actual = fixtures.path(`output.${filename}`);
const expected = fixtures.expected(filename);
return sharp({
create: {
width: 32, height: 32, channels: 4, background: red
}
})
.pipelineColourspace('scrgb')
.composite([{
input: fixtures.inputPngWithTransparency16bit,
blend: 'color-burn'
}])
.toFile(actual)
.then(() => {
fixtures.assertMaxColourDistance(actual, expected);
});
});
it('multiple', async () => { it('multiple', async () => {
const filename = 'composite-multiple.png'; const filename = 'composite-multiple.png';
const actual = fixtures.path(`output.${filename}`); const actual = fixtures.path(`output.${filename}`);

View File

@ -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, '9b2ea457de'); assert.strictEqual(locatorHash, '3ee8908a2b');
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;