diff --git a/src/ImageSharp/Formats/WebP/AlphaDecoder.cs b/src/ImageSharp/Formats/WebP/AlphaDecoder.cs index edb72564e2..fc071095b8 100644 --- a/src/ImageSharp/Formats/WebP/AlphaDecoder.cs +++ b/src/ImageSharp/Formats/WebP/AlphaDecoder.cs @@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Formats.WebP var bitReader = new Vp8LBitReader(data); this.LosslessDecoder = new WebPLosslessDecoder(bitReader, memoryAllocator, configuration); this.LosslessDecoder.DecodeImageStream(this.Vp8LDec, width, height, true); - this.Use8BDecode = Is8BOptimizable(this.Vp8LDec.Metadata); + this.Use8BDecode = this.Vp8LDec.Transforms.Count > 0 && Is8BOptimizable(this.Vp8LDec.Metadata); } } diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs index 3eb51a597c..87af15ef37 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs @@ -181,6 +181,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP [WithFile(Lossy.Alpha1, PixelTypes.Rgba32)] [WithFile(Lossy.Alpha2, PixelTypes.Rgba32)] [WithFile(Lossy.Alpha3, PixelTypes.Rgba32)] + [WithFile(Lossy.AlphaThinkingSmiley, PixelTypes.Rgba32)] public void WebpDecoder_CanDecode_Lossy_WithAlpha(TestImageProvider provider) where TPixel : unmanaged, IPixel { diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 67ef6cef35..6be4d3dc71 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -640,6 +640,7 @@ namespace SixLabors.ImageSharp.Tests public const string AlphaCompressedVerticalFilter = "WebP/alpha_filter_2_method_1.webp"; public const string AlphaNoCompressionGradientFilter = "WebP/alpha_filter_3_method_0.webp"; public const string AlphaCompressedGradientFilter = "WebP/alpha_filter_3_method_1.webp"; + public const string AlphaThinkingSmiley = "WebP/1602311202.webp"; } } } diff --git a/tests/Images/Input/WebP/1602311202.webp b/tests/Images/Input/WebP/1602311202.webp new file mode 100644 index 0000000000..4dfd0184fd --- /dev/null +++ b/tests/Images/Input/WebP/1602311202.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dac76bec0e5b23a988b0f2221e9b20e63dc207ef48f33e49a4336a874e2a915 +size 18406