Ensure negate op occurs after profile conversion (#4096)

- Adds CMYK to CMYK profile conversion tests
- Fixes existing greyscale plus alpha test expectation
This commit is contained in:
Adriaan Meuris
2024-05-13 13:23:11 +02:00
committed by GitHub
parent b5fddd7c5e
commit 29336f4cc7
7 changed files with 44 additions and 5 deletions

View File

@@ -106,6 +106,43 @@ describe('Colour space conversion', function () {
);
});
it('CMYK profile to CMYK profile conversion using perceptual intent', async () => {
const data = await sharp(fixtures.inputTiffFogra)
.resize(320, 240)
.toColourspace('cmyk')
.pipelineColourspace('cmyk')
.withIccProfile(fixtures.path('XCMYK 2017.icc'))
.raw()
.toBuffer();
const [c, m, y, k] = data;
assert.deepStrictEqual(
{ c, m, y, k },
{ c: 1, m: 239, y: 227, k: 5 }
);
});
it('CMYK profile to CMYK profile with negate', (done) => {
sharp(fixtures.inputTiffFogra)
.resize(320, 240)
.toColourspace('cmyk')
.pipelineColourspace('cmyk')
.withIccProfile(fixtures.path('XCMYK 2017.icc'))
.negate()
.toBuffer(function (err, data, info) {
if (err) throw err;
assert.strictEqual('tiff', info.format);
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
fixtures.assertSimilar(
fixtures.expected('colourspace.cmyk-to-cmyk-negated.tif'),
data,
{ threshold: 0 },
done
);
});
});
it('From sRGB with RGB16 pipeline, resize with gamma, to sRGB', function (done) {
sharp(fixtures.inputPngGradients)
.pipelineColourspace('rgb16')