Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIF animations with mixed disposal methods not handled correctly #114

Closed
kikokuo opened this issue Jul 10, 2023 · 2 comments
Closed

GIF animations with mixed disposal methods not handled correctly #114

kikokuo opened this issue Jul 10, 2023 · 2 comments

Comments

@kikokuo
Copy link

kikokuo commented Jul 10, 2023

Hi,
I found some gif file leak image. I using below code to handle flip and mirror. It worked great,
But some gif file leak image when using library to process save or transfrom.
How can I fix it or I miss some step?

PhotoSauce.MagicScaler.ProcessImageSettings processImageSettings = new()
{
	Width = gifPixelWidth,
	Height = gifPixelHeight,
	ResizeMode = PhotoSauce.MagicScaler.CropScaleMode.Stretch,
	HybridMode = PhotoSauce.MagicScaler.HybridScaleMode.Turbo
};

//Build pipeline And add orientation
using (var pl = MagicImageProcessor.BuildPipeline(m_sResourceFilePath, processImageSettings))
{
	using (var outfile = File.Create(sNewSourceFilePath))
	{
		if (IsVFlip)
			pl.AddTransform(new OrientationTransform(Orientation.FlipVertical));
		if (IsHFlip)
			pl.AddTransform(new OrientationTransform(Orientation.FlipHorizontal));				
		pl.WriteOutput(outfile);
	}
}

VS_Originals_ad778d82-0272-422b-b9fe-96940fdb35a4_resource_download
image

gif save test - 2023070701
image

@saucecontrol
Copy link
Owner

Thanks for the repro! The sample input you've provided has an unusual mix of frame disposal methods, which is not handled correctly in MagicScaler's animation optimizer. I'll get a fix pushed for that soon.

@saucecontrol saucecontrol changed the title Some gif file will leak image. GIF animations with mixed disposal methods not handled correctly Jul 19, 2023
@saucecontrol
Copy link
Owner

Thanks again for the report. The issue was quite a bit more complicated than I expected (I had made some invalid assumptions in my initial implementation), but it's finally fixed in 11e96cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants