mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure images with P3 profiles retain full gamut #2862
This commit is contained in:
1
test/fixtures/index.js
vendored
1
test/fixtures/index.js
vendored
@@ -92,6 +92,7 @@ module.exports = {
|
||||
inputPngRGBWithAlpha: getPath('2569067123_aca715a2ee_o.png'), // http://www.flickr.com/photos/grizdave/2569067123/ (same as inputJpg)
|
||||
inputPngImageInAlpha: getPath('image-in-alpha.png'), // https://github.com/lovell/sharp/issues/1597
|
||||
inputPngSolidAlpha: getPath('with-alpha.png'), // https://github.com/lovell/sharp/issues/1599
|
||||
inputPngP3: getPath('p3.png'), // https://github.com/lovell/sharp/issues/2862
|
||||
|
||||
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/p3.png
vendored
Normal file
BIN
test/fixtures/p3.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 610 B |
@@ -105,6 +105,25 @@ describe('Colour space conversion', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Convert P3 to sRGB', async () => {
|
||||
const [r, g, b] = await sharp(fixtures.inputPngP3)
|
||||
.raw()
|
||||
.toBuffer();
|
||||
assert.strictEqual(r, 255);
|
||||
assert.strictEqual(g, 0);
|
||||
assert.strictEqual(b, 0);
|
||||
});
|
||||
|
||||
it('Passthrough P3', async () => {
|
||||
const [r, g, b] = await sharp(fixtures.inputPngP3)
|
||||
.withMetadata({ icc: 'p3' })
|
||||
.raw()
|
||||
.toBuffer();
|
||||
assert.strictEqual(r, 234);
|
||||
assert.strictEqual(g, 51);
|
||||
assert.strictEqual(b, 34);
|
||||
});
|
||||
|
||||
it('Invalid pipelineColourspace input', function () {
|
||||
assert.throws(function () {
|
||||
sharp(fixtures.inputJpg)
|
||||
|
||||
Reference in New Issue
Block a user