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

NullReferenceException when trying to load an animated PNG #2666

Closed
4 tasks done
TheShihan opened this issue Feb 14, 2024 · 1 comment
Closed
4 tasks done

NullReferenceException when trying to load an animated PNG #2666

TheShihan opened this issue Feb 14, 2024 · 1 comment
Assignees

Comments

@TheShihan
Copy link

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.2

Other ImageSharp packages and versions

SixLabors.ImageSharp.Drawing 2.1.1

Environment (Operating system, version and so on)

Windows 11 23H2

.NET Framework version

.NET 7.0

Description

I am trying to load an animated PNG (that I previously created successfully using ImageSharp). Unfortunately I get a NullReferenceException when loading the stream:

var img = Image.Load(inputStream);

   at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.Identify(BufferedReadStream stream, CancellationToken cancellationToken)
   at SixLabors.ImageSharp.Formats.ImageDecoderUtilities.Identify(IImageDecoderInternals decoder, Configuration configuration, Stream stream, CancellationToken cancellationToken)
   at SixLabors.ImageSharp.Formats.Png.PngDecoder.Decode(PngDecoderOptions options, Stream stream, CancellationToken cancellationToken)
   at SixLabors.ImageSharp.Formats.SpecializedImageDecoder`1.Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken)
   at SixLabors.ImageSharp.Formats.ImageDecoder.<>c__DisplayClass1_0.<Decode>b__0(Stream s)
   at SixLabors.ImageSharp.Formats.ImageDecoder.<WithSeekableStream>g__PeformActionAndResetPosition|11_0[T](Stream s, Int64 position, <>c__DisplayClass11_0`1& )
   at SixLabors.ImageSharp.Formats.ImageDecoder.WithSeekableStream[T](DecoderOptions options, Stream stream, Func`2 action)
   at SixLabors.ImageSharp.Formats.ImageDecoder.Decode(DecoderOptions options, Stream stream)
   at SixLabors.ImageSharp.Image.Decode(DecoderOptions options, Stream stream)
   at SixLabors.ImageSharp.Image.<>c__DisplayClass80_0.<Load>b__0(Stream s)
   at SixLabors.ImageSharp.Image.WithSeekableStream[T](DecoderOptions options, Stream stream, Func`2 action)
   at SixLabors.ImageSharp.Image.Load(DecoderOptions options, Stream stream)
   at SixLabors.ImageSharp.Image.Load(Stream stream)

The image loads fine for example in Chrome and the animation plays.

Steps to Reproduce

  1. Use the image provided
  2. Create a stream using (var fileStream = await file.OpenAsync(FileAccessMode.Read))
  3. Try to load it with: var img = Image.Load(inputStream);
  4. NullReferenceException occurs

Images

202402142208_qooli_gifeditor

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

No branches or pull requests

2 participants