Skip to content

When load an animated webp image throws "SixLabors.ImageSharp.ImageFormatException: Unexpected chunk followed VP8X header" exception. #2154

Description

@Hellobaka

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

2.1.2

Other ImageSharp packages and versions

SixLabors.ImageSharp.Drawing 1.0.0-beta14; Sixlabors.Fonts 1.0.0-beta17

Environment (Operating system, version and so on)

Win10 21H2

.NET Framework version

.net 5.0.402

Description

https://mathiasbynens.be/demo/animated-webp-supported.webp

I have seen the feature support PR, but I still cannot load animated webp images. Maybe the method I used is wrong.

Steps to Reproduce

  1. download the example image
  2. load with code
Image img = Image.Load(@"1.webp");

then exception throws.

Unhandled exception. SixLabors.ImageSharp.ImageFormatException: Unexpected chunk followed VP8X header
   at SixLabors.ImageSharp.Formats.Webp.WebpThrowHelper.ThrowImageFormatException(String errorMessage)
   at SixLabors.ImageSharp.Formats.Webp.WebpDecoderCore.ReadVp8XHeader()
   at SixLabors.ImageSharp.Formats.Webp.WebpDecoderCore.ReadVp8Info()
   at SixLabors.ImageSharp.Formats.Webp.WebpDecoderCore.Decode[TPixel](BufferedReadStream stream, CancellationToken cancellationToken)
   at SixLabors.ImageSharp.Formats.ImageDecoderUtilities.Decode[TPixel](IImageDecoderInternals decoder, Configuration configuration, Stream stream, Func`3
largeImageExceptionFactory, CancellationToken cancellationToken)
   at SixLabors.ImageSharp.Formats.ImageDecoderUtilities.Decode[TPixel](IImageDecoderInternals decoder, Configuration configuration, Stream stream, Cancell
ationToken cancellationToken)
   at SixLabors.ImageSharp.Formats.Webp.WebpDecoder.Decode[TPixel](Configuration configuration, Stream stream, CancellationToken cancellationToken)
   at SixLabors.ImageSharp.Formats.Webp.WebpDecoder.Decode(Configuration configuration, Stream stream, CancellationToken cancellationToken)
   at SixLabors.ImageSharp.Image.Decode(Stream stream, Configuration config, CancellationToken cancellationToken)
   at SixLabors.ImageSharp.Image.<>c__DisplayClass134_0.<Load>b__0(Stream s)
   at SixLabors.ImageSharp.Image.WithSeekableStream[T](Configuration configuration, Stream stream, Func`2 action)
   at SixLabors.ImageSharp.Image.Load(Configuration configuration, Stream stream, IImageFormat& format)
   at SixLabors.ImageSharp.Image.Load(Configuration configuration, String path, IImageFormat& format)
   at SixLabors.ImageSharp.Image.Load(Configuration configuration, String path)
   at SixLabors.ImageSharp.Image.Load(String path)
   at BilibiliMonitor.Program.Main(String[] args) in E:\编程\程序c#\BilibiliMonitor\BilibiliMonitor\Program.cs:line 19

Images

test img

Activity

  1. brianpopow commented on Jun 16, 2022

    @brianpopow
    Collaborator

    Decoding animated webp images is not supported in 2.1.2, but the error message is wrong though. The expected error message should have been NotSupportedException, but the ANIM chunk is not recognized as an optional VP8X chunk.

    The error does not occur in main. Decoding animated webp images was added recently with #1985. For missing webp features see #1802.

    You can try our nightly build to verify that.

  2. Hellobaka commented on Jun 16, 2022

    @Hellobaka
    Author

    Decoding animated webp images is not supported in 2.1.2, but the error message is wrong though. The expected error message should have been NotSupportedException, but the ANIM chunk is not recognized as an optional VP8X chunk.

    The error does not occur in main. Decoding animated webp images was added recently with #1985. For missing webp features see #1802.

    You can try our nightly build to verify that.

    Thank you. I tried the nightly build and the program successfully loaded the animated webp image. Hope this feature be added to stable branch soon. Thanks for all your work.

  3. added 2 commits that reference this issue on Jun 17, 2022
    b2857ae
    f53c78d
  4. marshafan commented on Aug 29, 2023

    @marshafan

    i came into a different problem,as i uploaded the animated webp image above using 3.0.1(Sixlabor.ImageSharp.dll),and finally called saveAsync ,it produced a static webp which had just one frame.
    By debugging,it showed that the Image instance as a result of Image.Load(byte[]),had a Frames property eqauled to 1.
    What might be the reason?thank you for your answer^_^

  5. JimBobSquarePants commented on Aug 29, 2023

    @JimBobSquarePants
    Member

    i came into a different problem,as i uploaded the animated webp image above using 3.0.1(Sixlabor.ImageSharp.dll),and finally called saveAsync ,it produced a static webp which had just one frame.

    Then why did you comment on this closed issue?

  6. marshafan commented on Aug 29, 2023

    @marshafan

    i came into a different problem,as i uploaded the animated webp image above using 3.0.1(Sixlabor.ImageSharp.dll),and finally called saveAsync ,it produced a static webp which had just one frame.

    Then why did you comment on this closed issue?

    sorry,i should create a new one..

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