mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Fix tint op by ensuring LAB and allowing negative values #1235
Add test cases for more tint colours and input interpretations
This commit is contained in:
@@ -19,6 +19,32 @@ describe('Tint', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('tints rgb image green', function (done) {
|
||||
const output = fixtures.path('output.tint-green.jpg');
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.tint('#00FF00')
|
||||
.toFile(output, function (err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, info.size > 0);
|
||||
fixtures.assertMaxColourDistance(output, fixtures.expected('tint-green.jpg'), 10);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('tints rgb image blue', function (done) {
|
||||
const output = fixtures.path('output.tint-blue.jpg');
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.tint('#0000FF')
|
||||
.toFile(output, function (err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, info.size > 0);
|
||||
fixtures.assertMaxColourDistance(output, fixtures.expected('tint-blue.jpg'), 10);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('tints rgb image with sepia tone', function (done) {
|
||||
const output = fixtures.path('output.tint-sepia.jpg');
|
||||
sharp(fixtures.inputJpg)
|
||||
@@ -60,4 +86,17 @@ describe('Tint', function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('tints cmyk image red', function (done) {
|
||||
const output = fixtures.path('output.tint-cmyk.jpg');
|
||||
sharp(fixtures.inputJpgWithCmykProfile)
|
||||
.resize(320, 240)
|
||||
.tint('#FF0000')
|
||||
.toFile(output, function (err, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, info.size > 0);
|
||||
fixtures.assertMaxColourDistance(output, fixtures.expected('tint-cmyk.jpg'), 10);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user