Ensure resize fit=inside respects 90/270 rotate #3756

This commit is contained in:
Lovell Fuller
2023-08-14 13:45:23 +01:00
parent 3d01775972
commit 5c19f6dd9b
3 changed files with 30 additions and 0 deletions

View File

@@ -489,4 +489,28 @@ describe('Rotation', function () {
.timeout({ seconds: 5 })
.toBuffer()
);
it('Rotate 90 then resize with inside fit', async () => {
const data = await sharp({ create: { width: 16, height: 8, channels: 3, background: 'red' } })
.rotate(90)
.resize({ width: 6, fit: 'inside' })
.png({ compressionLevel: 0 })
.toBuffer();
const { width, height } = await sharp(data).metadata();
assert.strictEqual(width, 6);
assert.strictEqual(height, 12);
});
it('Resize with inside fit then rotate 90', async () => {
const data = await sharp({ create: { width: 16, height: 8, channels: 3, background: 'red' } })
.resize({ width: 6, fit: 'inside' })
.rotate(90)
.png({ compressionLevel: 0 })
.toBuffer();
const { width, height } = await sharp(data).metadata();
assert.strictEqual(width, 3);
assert.strictEqual(height, 6);
});
});