Fix MNG frame disposal for transparent animations (#8625)

Reader: set image->dispose=BackgroundDispose when MNG framing_mode
is 3 (restore background before next frame). Previously disposal was
never set from framing_mode, defaulting to NoneDispose and losing the
disposal information on read.

Writer: trigger framing_mode=3 when image->dispose >= BackgroundDispose
(value 2) instead of only >= PreviousDispose (value 3). This was an
off-by-one in the dispose check that prevented BackgroundDispose from
producing the correct MNG framing mode.

Together these ensure disposal information survives read-edit-write
cycles for transparent MNG animations.
This commit is contained in:
Madars
2026-03-21 14:25:16 +02:00
committed by GitHub
parent c7fd5e5bbe
commit db02adc582
+6 -1
View File
@@ -6328,6 +6328,11 @@ static Image *ReadOneMNGImage(MngReadInfo* mng_info,
else
image->delay=0;
if (mng_info->framing_mode == 3)
image->dispose=BackgroundDispose;
else
image->dispose=NoneDispose;
image->page.width=mng_info->mng_width;
image->page.height=mng_info->mng_height;
image->page.x=mng_info->x_off[object_id];
@@ -13583,7 +13588,7 @@ static MagickBooleanType WriteMNGImage(const ImageInfo *image_info,Image *image,
mng_info->write_mng=write_mng;
if ((int) image->dispose >= 3)
if ((int) image->dispose >= BackgroundDispose)
mng_info->framing_mode=3;
if (mng_info->need_fram != MagickFalse && mng_info->adjoin != MagickFalse &&