Skip empty frames when comparing layers
Posted: 2015-03-20T13:51:20-07:00
When two consecutive frames are identical, the second one will be turned into an empty frame. In this case, the empty frame should be skipped when comparing layers. This patch should fix the problem.
Code: Select all
[[[
Index: magick/layer.c
===================================================================
--- magick/layer.c (revision 18240)
+++ magick/layer.c (working copy)
@@ -854,6 +854,14 @@
next=GetNextImageInList(next);
for ( ; next != (const Image *) NULL; next=GetNextImageInList(next))
{
+ if (bounds[i].x == -1 && bounds[i].y == -1 &&
+ bounds[i].width == 1 && bounds[i].height == 1) {
+ // An empty frame is returned from CompareImageBounds(), which
+ // means the current frame is identical to the previous frame.
+ i++;
+ continue;
+ }
+
image_a=CloneImage(next,0,0,MagickTrue,exception);
if (image_a == (Image *) NULL)
break;
]]]