Browse Source

Fix issue in ExtractAlphaRows: Filter needs to be applied after extract green

pull/1552/head
Brian Popow 6 years ago
parent
commit
38a88b2adc
  1. 2
      src/ImageSharp/Formats/WebP/AlphaDecoder.cs
  2. 1
      tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs
  3. 1
      tests/ImageSharp.Tests/TestImages.cs
  4. 3
      tests/Images/Input/WebP/sticker.webp

2
src/ImageSharp/Formats/WebP/AlphaDecoder.cs

@ -261,8 +261,8 @@ namespace SixLabors.ImageSharp.Formats.Experimental.WebP
// Extract alpha (which is stored in the green plane).
int pixelCount = width * numRowsToProcess;
WebPLosslessDecoder.ApplyInverseTransforms(dec, input, this.memoryAllocator);
this.AlphaApplyFilter(0, numRowsToProcess, output, width);
ExtractGreen(input, output, pixelCount);
this.AlphaApplyFilter(0, numRowsToProcess, output, width);
}
private static void ColorIndexInverseTransformAlpha(

1
tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs

@ -189,6 +189,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP
[WithFile(Lossy.Alpha2, PixelTypes.Rgba32)]
[WithFile(Lossy.Alpha3, PixelTypes.Rgba32)]
[WithFile(Lossy.AlphaThinkingSmiley, PixelTypes.Rgba32)]
[WithFile(Lossy.AlphaSticker, PixelTypes.Rgba32)]
public void WebpDecoder_CanDecode_Lossy_WithAlpha<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{

1
tests/ImageSharp.Tests/TestImages.cs

@ -641,6 +641,7 @@ namespace SixLabors.ImageSharp.Tests
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";
public const string AlphaSticker = "WebP/Sticker.webp";
}
}
}

3
tests/Images/Input/WebP/sticker.webp

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:49795fc80522dae2ca687b345c21e9b0848f307d3cc3e39fbdcda730772d338c
size 27734
Loading…
Cancel
Save