mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Remove animation props from single page images #2890
This commit is contained in:
parent
7ae151362b
commit
d359331426
@ -10,6 +10,9 @@ Requires libvips v8.11.3
|
||||
|
||||
* Ensure `sharp.versions` is populated from vendored libvips.
|
||||
|
||||
* Remove animation properties from single page images.
|
||||
[#2890](https://github.com/lovell/sharp/issues/2890)
|
||||
|
||||
* Allow use of 'tif' to select TIFF output.
|
||||
[#2893](https://github.com/lovell/sharp/pull/2893)
|
||||
[@erf](https://github.com/erf)
|
||||
|
@ -289,6 +289,10 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
yfactor = static_cast<double>(shrunkOnLoadHeight) / static_cast<double>(targetResizeHeight);
|
||||
}
|
||||
}
|
||||
// Remove animation properties from single page images
|
||||
if (baton->input->pages == 1) {
|
||||
image = sharp::RemoveAnimationProperties(image);
|
||||
}
|
||||
|
||||
// Ensure we're using a device-independent colour space
|
||||
char const *processingProfile = image.interpretation() == VIPS_INTERPRETATION_RGB16 ? "p3" : "srgb";
|
||||
|
@ -209,4 +209,24 @@ describe('WebP', function () {
|
||||
fixtures.assertSimilar(fixtures.inputWebPAnimated, data, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('should remove animation properties when loading single page', async () => {
|
||||
const data = await sharp(fixtures.inputGifAnimatedLoop3)
|
||||
.resize({ height: 570 })
|
||||
.webp({ reductionEffort: 0 })
|
||||
.toBuffer();
|
||||
const metadata = await sharp(data).metadata();
|
||||
assert.deepStrictEqual(metadata, {
|
||||
format: 'webp',
|
||||
size: 2580,
|
||||
width: 740,
|
||||
height: 570,
|
||||
space: 'srgb',
|
||||
channels: 3,
|
||||
depth: 'uchar',
|
||||
isProgressive: false,
|
||||
hasProfile: false,
|
||||
hasAlpha: false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user