mirror of https://github.com/SixLabors/ImageSharp
Browse Source
* Add webp decoder option BackgroundColorHandling to decide howto handle the background color in the ANIM chunk
* Add test for Issue 2528
* Update src/ImageSharp/Formats/Webp/BackgroundColorHandling.cs
Co-authored-by: James Jackson-South <james_south@hotmail.com>
* Fix path to test file
* Another attempt fixing the file path: path should be lower case
* Revert fa4febf7
---------
Co-authored-by: James Jackson-South <james_south@hotmail.com>
pull/2550/head
committed by
GitHub
10 changed files with 103 additions and 15 deletions
@ -0,0 +1,21 @@ |
|||||
|
// Copyright (c) Six Labors.
|
||||
|
// Licensed under the Six Labors Split License.
|
||||
|
|
||||
|
namespace SixLabors.ImageSharp.Formats.Webp; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Enum to decide how to handle the background color of the Animation chunk during decoding.
|
||||
|
/// </summary>
|
||||
|
public enum BackgroundColorHandling |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// The background color of the ANIM chunk will be used to initialize the canvas to fill the unused space on the canvas around the frame.
|
||||
|
/// Also, if AnimationDisposalMethod.Dispose is used, this color will be used to restore the canvas background.
|
||||
|
/// </summary>
|
||||
|
Standard = 0, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// The background color of the ANIM chunk is ignored and instead the canvas is initialized with transparent, BGRA(0, 0, 0, 0).
|
||||
|
/// </summary>
|
||||
|
Ignore = 1 |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
// Copyright (c) Six Labors.
|
||||
|
// Licensed under the Six Labors Split License.
|
||||
|
|
||||
|
namespace SixLabors.ImageSharp.Formats.Webp; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Configuration options for decoding webp images.
|
||||
|
/// </summary>
|
||||
|
public sealed class WebpDecoderOptions : ISpecializedDecoderOptions |
||||
|
{ |
||||
|
/// <inheritdoc/>
|
||||
|
public DecoderOptions GeneralOptions { get; init; } = new(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the flag to decide how to handle the background color Animation Chunk.
|
||||
|
/// The specification is vague on how to handle the background color of the animation chunk.
|
||||
|
/// This option let's the user choose how to deal with it.
|
||||
|
/// </summary>
|
||||
|
/// <see href="https://developers.google.com/speed/webp/docs/riff_container#animation"/>
|
||||
|
public BackgroundColorHandling BackgroundColorHandling { get; init; } = BackgroundColorHandling.Standard; |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:b4aa2ba2e6ef0263b5b657e4d15241d497721a0461250b1d942751812b96de71 |
||||
|
size 60214 |
||||
Loading…
Reference in new issue