mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Expose control over CPU effort for palette PNG #2541
This commit is contained in:
@@ -143,8 +143,8 @@ describe('PNG', function () {
|
||||
it('Valid PNG libimagequant quality value produces image of same size or smaller', function () {
|
||||
const inputPngBuffer = fs.readFileSync(fixtures.inputPng);
|
||||
return Promise.all([
|
||||
sharp(inputPngBuffer).resize(10).png({ quality: 80 }).toBuffer(),
|
||||
sharp(inputPngBuffer).resize(10).png({ quality: 100 }).toBuffer()
|
||||
sharp(inputPngBuffer).resize(10).png({ effort: 1, quality: 80 }).toBuffer(),
|
||||
sharp(inputPngBuffer).resize(10).png({ effort: 1, quality: 100 }).toBuffer()
|
||||
]).then(function (data) {
|
||||
assert.strictEqual(true, data[0].length <= data[1].length);
|
||||
});
|
||||
@@ -156,6 +156,12 @@ describe('PNG', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Invalid effort value throws error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().png({ effort: 0.1 });
|
||||
});
|
||||
});
|
||||
|
||||
it('Valid PNG libimagequant colours value produces image of same size or smaller', function () {
|
||||
const inputPngBuffer = fs.readFileSync(fixtures.inputPng);
|
||||
return Promise.all([
|
||||
|
||||
Reference in New Issue
Block a user