mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Skip shrink-on-load where one dimension <4px #2653
This commit is contained in:
@@ -605,6 +605,26 @@ describe('Resize dimensions', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Skip shrink-on-load where one dimension <4px', async () => {
|
||||
const jpeg = await sharp({
|
||||
create: {
|
||||
width: 100,
|
||||
height: 3,
|
||||
channels: 3,
|
||||
background: 'red'
|
||||
}
|
||||
})
|
||||
.jpeg()
|
||||
.toBuffer();
|
||||
|
||||
const { info } = await sharp(jpeg)
|
||||
.resize(8)
|
||||
.toBuffer({ resolveWithObject: true });
|
||||
|
||||
assert.strictEqual(info.width, 8);
|
||||
assert.strictEqual(info.height, 1);
|
||||
});
|
||||
|
||||
it('unknown kernel throws', function () {
|
||||
assert.throws(function () {
|
||||
sharp().resize(null, null, { kernel: 'unknown' });
|
||||
|
||||
Reference in New Issue
Block a user