From 165fff0cf2d1e431b12e8f289b5fb27e26dc8f72 Mon Sep 17 00:00:00 2001 From: TheEssem Date: Sat, 6 Mar 2021 11:39:54 -0600 Subject: [PATCH] Fixed dispose weirdness with caption and spin --- natives/caption.cc | 1 + natives/spin.cc | 3 +++ 2 files changed, 4 insertions(+) diff --git a/natives/caption.cc b/natives/caption.cc index a56b3b3..efd9307 100644 --- a/natives/caption.cc +++ b/natives/caption.cc @@ -41,6 +41,7 @@ class CaptionWorker : public Napi::AsyncWorker { appended.repage(); appended.magick(type); appended.animationDelay(delay == 0 ? image.animationDelay() : delay); + appended.gifDisposeMethod(Magick::BackgroundDispose); captioned.push_back(appended); } diff --git a/natives/spin.cc b/natives/spin.cc index 950f4ab..03bad09 100644 --- a/natives/spin.cc +++ b/natives/spin.cc @@ -27,6 +27,7 @@ class SpinWorker : public Napi::AsyncWorker { int i = 0; for (Image &image : coalesced) { + image.virtualPixelMethod(Magick::TransparentVirtualPixelMethod); image.scale(Geometry("256x256")); image.alphaChannel(Magick::SetAlphaChannel); double rotation[1] = {360 * i / coalesced.size()}; @@ -36,6 +37,8 @@ class SpinWorker : public Napi::AsyncWorker { i++; } + for_each(mid.begin(), mid.end(), gifDisposeMethodImage(Magick::BackgroundDispose)); + optimizeTransparency(mid.begin(), mid.end()); if (delay != 0) { for_each(mid.begin(), mid.end(), animationDelayImage(delay));