mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure keepIccProfile avoids ICC transform #4186
This commit is contained in:
1
test/fixtures/index.js
vendored
1
test/fixtures/index.js
vendored
@@ -99,6 +99,7 @@ module.exports = {
|
||||
inputPngTrimSpecificColour16bit: getPath('Flag_of_the_Netherlands-16bit.png'), // convert Flag_of_the_Netherlands.png -depth 16 Flag_of_the_Netherlands-16bit.png
|
||||
inputPngTrimSpecificColourIncludeAlpha: getPath('Flag_of_the_Netherlands-alpha.png'), // convert Flag_of_the_Netherlands.png -alpha set -background none -channel A -evaluate multiply 0.5 +channel Flag_of_the_Netherlands-alpha.png
|
||||
inputPngUint32Limit: getPath('65536-uint32-limit.png'), // https://alexandre.alapetite.fr/doc-alex/large-image/
|
||||
inputPngWithProPhotoProfile: getPath('prophoto.png'),
|
||||
|
||||
inputWebP: getPath('4.webp'), // http://www.gstatic.com/webp/gallery/4.webp
|
||||
inputWebPWithTransparency: getPath('5_webp_a.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
|
||||
|
||||
BIN
test/fixtures/prophoto.png
vendored
Normal file
BIN
test/fixtures/prophoto.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 556 B |
@@ -601,6 +601,17 @@ describe('Image metadata', function () {
|
||||
assert.strictEqual(description, 'Generic RGB Profile');
|
||||
});
|
||||
|
||||
it('keep existing ICC profile, avoid colour transform', async () => {
|
||||
const [r, g, b] = await sharp(fixtures.inputPngWithProPhotoProfile)
|
||||
.keepIccProfile()
|
||||
.raw()
|
||||
.toBuffer();
|
||||
|
||||
assert.strictEqual(r, 131);
|
||||
assert.strictEqual(g, 141);
|
||||
assert.strictEqual(b, 192);
|
||||
});
|
||||
|
||||
it('keep existing CMYK ICC profile', async () => {
|
||||
const data = await sharp(fixtures.inputJpgWithCmykProfile)
|
||||
.pipelineColourspace('cmyk')
|
||||
|
||||
Reference in New Issue
Block a user