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));