Sitelet https://github.com/SixLabors/ImageSharp/issues/2708
Skip to content

APNG Decoder incorrectly handles frame offsets and dispose previous with blend over #2708

Description

@SpaceCheetah

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

ImageSharp version

3.1.3

Other ImageSharp packages and versions

None

Environment (Operating system, version and so on)

Windows 11

.NET Framework version

.net8.0

Description

For APNG, the decoder has various significant issues handling certain cases.
For instance, in APNG, for compression, frames are allowed to be smaller than the overall image with an offset. The decoder currently does not take that offset into account.
Additionally, there seem to be some issues with dispose previous, blend over.
Both of these issues are represented in the test image below.

Steps to Reproduce

using SixLabors.ImageSharp;

Image image = Image.Load("test.png");
for (int i = 0; i < image.Frames.Count; i++) {
    image.Frames.CloneFrame(i).SaveAsPng($"{i}.png");
}

Images

Original:
test
Outputted frames:
0
1
2
3
4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions