mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Ensure animated GIF output is optimised #2376
This commit is contained in:
parent
d46b4d950f
commit
6c5cde363a
@ -21,6 +21,9 @@ Requires libvips v8.10.0
|
|||||||
* Ensure `stats` can be calculated for 1x1 input.
|
* Ensure `stats` can be calculated for 1x1 input.
|
||||||
[#2372](https://github.com/lovell/sharp/issues/2372)
|
[#2372](https://github.com/lovell/sharp/issues/2372)
|
||||||
|
|
||||||
|
* Ensure animated GIF output is optimised.
|
||||||
|
[#2376](https://github.com/lovell/sharp/issues/2376)
|
||||||
|
|
||||||
### v0.26.0 - 25th August 2020
|
### v0.26.0 - 25th August 2020
|
||||||
|
|
||||||
* Prebuilt libvips binaries are now statically-linked and Brotli-compressed, requiring Node.js 10.16.0+.
|
* Prebuilt libvips binaries are now statically-linked and Brotli-compressed, requiring Node.js 10.16.0+.
|
||||||
|
@ -782,6 +782,8 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|||||||
sharp::AssertImageTypeDimensions(image, sharp::ImageType::GIF);
|
sharp::AssertImageTypeDimensions(image, sharp::ImageType::GIF);
|
||||||
VipsArea *area = VIPS_AREA(image.magicksave_buffer(VImage::option()
|
VipsArea *area = VIPS_AREA(image.magicksave_buffer(VImage::option()
|
||||||
->set("strip", !baton->withMetadata)
|
->set("strip", !baton->withMetadata)
|
||||||
|
->set("optimize_gif_frames", TRUE)
|
||||||
|
->set("optimize_gif_transparency", TRUE)
|
||||||
->set("format", "gif")));
|
->set("format", "gif")));
|
||||||
baton->bufferOut = static_cast<char*>(area->data);
|
baton->bufferOut = static_cast<char*>(area->data);
|
||||||
baton->bufferOutLength = area->length;
|
baton->bufferOutLength = area->length;
|
||||||
@ -925,6 +927,8 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|||||||
sharp::AssertImageTypeDimensions(image, sharp::ImageType::GIF);
|
sharp::AssertImageTypeDimensions(image, sharp::ImageType::GIF);
|
||||||
image.magicksave(const_cast<char*>(baton->fileOut.data()), VImage::option()
|
image.magicksave(const_cast<char*>(baton->fileOut.data()), VImage::option()
|
||||||
->set("strip", !baton->withMetadata)
|
->set("strip", !baton->withMetadata)
|
||||||
|
->set("optimize_gif_frames", TRUE)
|
||||||
|
->set("optimize_gif_transparency", TRUE)
|
||||||
->set("format", "gif"));
|
->set("format", "gif"));
|
||||||
baton->formatOut = "gif";
|
baton->formatOut = "gif";
|
||||||
} else if (baton->formatOut == "tiff" || (mightMatchInput && isTiff) ||
|
} else if (baton->formatOut == "tiff" || (mightMatchInput && isTiff) ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user