From 7b9d4ce269eb199caf5d4fb5b63e6fd2855bef10 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Fri, 15 May 2020 14:20:18 +0200 Subject: [PATCH] Intial stubs of files needed for webp encoding --- src/ImageSharp/Advanced/AotCompilerTools.cs | 2 + .../Formats/WebP/BitWriter/Vp8BitWriter.cs | 12 +++++ .../Formats/WebP/BitWriter/Vp8LBitWriter.cs | 12 +++++ .../Formats/WebP/IWebPEncoderOptions.cs | 12 +++++ .../Formats/WebP/ImageExtensions.cs | 36 +++++++++++++ src/ImageSharp/Formats/WebP/WebPEncoder.cs | 23 ++++++++ .../Formats/WebP/WebPEncoderCore.cs | 53 +++++++++++++++++++ .../Formats/WebP/WebpConfigurationModule.cs | 1 + .../Codecs/DecodeWebp.cs | 46 ++++++++-------- .../Formats/GeneralFormatTests.cs | 9 +++- .../Formats/ImageFormatManagerTests.cs | 3 ++ .../TestUtilities/TestEnvironment.Formats.cs | 4 +- .../Tests/TestEnvironmentTests.cs | 4 ++ tests/Images/Input/WebP/earth_lossless.webp | 4 +- tests/Images/Input/WebP/earth_lossy.webp | 4 +- 15 files changed, 197 insertions(+), 28 deletions(-) create mode 100644 src/ImageSharp/Formats/WebP/BitWriter/Vp8BitWriter.cs create mode 100644 src/ImageSharp/Formats/WebP/BitWriter/Vp8LBitWriter.cs create mode 100644 src/ImageSharp/Formats/WebP/IWebPEncoderOptions.cs create mode 100644 src/ImageSharp/Formats/WebP/ImageExtensions.cs create mode 100644 src/ImageSharp/Formats/WebP/WebPEncoder.cs create mode 100644 src/ImageSharp/Formats/WebP/WebPEncoderCore.cs diff --git a/src/ImageSharp/Advanced/AotCompilerTools.cs b/src/ImageSharp/Advanced/AotCompilerTools.cs index 2ea456286..6ea9075eb 100644 --- a/src/ImageSharp/Advanced/AotCompilerTools.cs +++ b/src/ImageSharp/Advanced/AotCompilerTools.cs @@ -94,6 +94,8 @@ namespace SixLabors.ImageSharp.Advanced AotCodec(new Formats.Bmp.BmpDecoder(), new Formats.Bmp.BmpEncoder()); AotCodec(new Formats.Gif.GifDecoder(), new Formats.Gif.GifEncoder()); AotCodec(new Formats.Jpeg.JpegDecoder(), new Formats.Jpeg.JpegEncoder()); + AotCodec(new Formats.Tga.TgaDecoder(), new Formats.Tga.TgaEncoder()); + AotCodec(new Formats.WebP.WebPDecoder(), new Formats.WebP.WebPEncoder()); // TODO: Do the discovery work to figure out what works and what doesn't. } diff --git a/src/ImageSharp/Formats/WebP/BitWriter/Vp8BitWriter.cs b/src/ImageSharp/Formats/WebP/BitWriter/Vp8BitWriter.cs new file mode 100644 index 000000000..974d18c9a --- /dev/null +++ b/src/ImageSharp/Formats/WebP/BitWriter/Vp8BitWriter.cs @@ -0,0 +1,12 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the GNU Affero General Public License, Version 3. + +namespace SixLabors.ImageSharp.Formats.WebP.BitWriter +{ + /// + /// A bit writer for writing lossless webp streams. + /// + internal class Vp8BitWriter + { + } +} diff --git a/src/ImageSharp/Formats/WebP/BitWriter/Vp8LBitWriter.cs b/src/ImageSharp/Formats/WebP/BitWriter/Vp8LBitWriter.cs new file mode 100644 index 000000000..925592fb6 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/BitWriter/Vp8LBitWriter.cs @@ -0,0 +1,12 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the GNU Affero General Public License, Version 3. + +namespace SixLabors.ImageSharp.Formats.WebP.BitWriter +{ + /// + /// A bit writer for writing lossless webp streams. + /// + internal class Vp8LBitWriter + { + } +} diff --git a/src/ImageSharp/Formats/WebP/IWebPEncoderOptions.cs b/src/ImageSharp/Formats/WebP/IWebPEncoderOptions.cs new file mode 100644 index 000000000..e29a446c9 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/IWebPEncoderOptions.cs @@ -0,0 +1,12 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the GNU Affero General Public License, Version 3. + +namespace SixLabors.ImageSharp.Formats.WebP +{ + /// + /// Configuration options for use during webp encoding. + /// + internal interface IWebPEncoderOptions + { + } +} diff --git a/src/ImageSharp/Formats/WebP/ImageExtensions.cs b/src/ImageSharp/Formats/WebP/ImageExtensions.cs new file mode 100644 index 000000000..5ceb85d74 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/ImageExtensions.cs @@ -0,0 +1,36 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the GNU Affero General Public License, Version 3. + +using System.IO; + +using SixLabors.ImageSharp.Advanced; +using SixLabors.ImageSharp.Formats.WebP; + +namespace SixLabors.ImageSharp +{ + /// + /// Extension methods for the type. + /// + public static partial class ImageExtensions + { + /// + /// Saves the image to the given stream with the webp format. + /// + /// The image this method extends. + /// The stream to save the image to. + /// Thrown if the stream is null. + public static void SaveAsWebp(this Image source, Stream stream) => SaveAsWebp(source, stream, null); + + /// + /// Saves the image to the given stream with the webp format. + /// + /// The image this method extends. + /// The stream to save the image to. + /// The options for the encoder. + /// Thrown if the stream is null. + public static void SaveAsWebp(this Image source, Stream stream, WebPEncoder encoder) => + source.Save( + stream, + encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(WebPFormat.Instance)); + } +} diff --git a/src/ImageSharp/Formats/WebP/WebPEncoder.cs b/src/ImageSharp/Formats/WebP/WebPEncoder.cs new file mode 100644 index 000000000..b201e0e8d --- /dev/null +++ b/src/ImageSharp/Formats/WebP/WebPEncoder.cs @@ -0,0 +1,23 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the GNU Affero General Public License, Version 3. + +using System.IO; +using SixLabors.ImageSharp.Advanced; +using SixLabors.ImageSharp.PixelFormats; + +namespace SixLabors.ImageSharp.Formats.WebP +{ + /// + /// Image encoder for writing an image to a stream in the WebP format. + /// + public sealed class WebPEncoder : IImageEncoder, IWebPEncoderOptions + { + /// + public void Encode(Image image, Stream stream) + where TPixel : unmanaged, IPixel + { + var encoder = new WebPEncoderCore(this, image.GetMemoryAllocator()); + encoder.Encode(image, stream); + } + } +} diff --git a/src/ImageSharp/Formats/WebP/WebPEncoderCore.cs b/src/ImageSharp/Formats/WebP/WebPEncoderCore.cs new file mode 100644 index 000000000..bf437d985 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/WebPEncoderCore.cs @@ -0,0 +1,53 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the GNU Affero General Public License, Version 3. + +using System.IO; +using SixLabors.ImageSharp.Advanced; +using SixLabors.ImageSharp.Memory; +using SixLabors.ImageSharp.Metadata; +using SixLabors.ImageSharp.PixelFormats; + +namespace SixLabors.ImageSharp.Formats.WebP +{ + /// + /// Image encoder for writing an image to a stream in the WebP format. + /// + internal sealed class WebPEncoderCore + { + /// + /// Used for allocating memory during processing operations. + /// + private readonly MemoryAllocator memoryAllocator; + + /// + /// The global configuration. + /// + private Configuration configuration; + + /// + /// Initializes a new instance of the class. + /// + /// The encoder options. + /// The memory manager. + public WebPEncoderCore(IWebPEncoderOptions options, MemoryAllocator memoryAllocator) + { + this.memoryAllocator = memoryAllocator; + } + + /// + /// Encodes the image to the specified stream from the . + /// + /// The pixel format. + /// The to encode from. + /// The to encode the image data to. + public void Encode(Image image, Stream stream) + where TPixel : unmanaged, IPixel + { + Guard.NotNull(image, nameof(image)); + Guard.NotNull(stream, nameof(stream)); + + this.configuration = image.GetConfiguration(); + ImageMetadata metadata = image.Metadata; + } + } +} diff --git a/src/ImageSharp/Formats/WebP/WebpConfigurationModule.cs b/src/ImageSharp/Formats/WebP/WebpConfigurationModule.cs index d5e6eea6d..2fa4c7e7b 100644 --- a/src/ImageSharp/Formats/WebP/WebpConfigurationModule.cs +++ b/src/ImageSharp/Formats/WebP/WebpConfigurationModule.cs @@ -12,6 +12,7 @@ namespace SixLabors.ImageSharp.Formats.WebP public void Configure(Configuration configuration) { configuration.ImageFormatsManager.SetDecoder(WebPFormat.Instance, new WebPDecoder()); + configuration.ImageFormatsManager.SetEncoder(WebPFormat.Instance, new WebPEncoder()); configuration.ImageFormatsManager.AddImageFormatDetector(new WebPImageFormatDetector()); } } diff --git a/tests/ImageSharp.Benchmarks/Codecs/DecodeWebp.cs b/tests/ImageSharp.Benchmarks/Codecs/DecodeWebp.cs index 5aa1810cc..43dc8f9d5 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/DecodeWebp.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/DecodeWebp.cs @@ -67,28 +67,30 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs return image.Height; } - /* Results 18.03.2020 - * BenchmarkDotNet=v0.12.0, OS=Windows 10.0.18362 - Intel Core i7-6700K CPU 4.00GHz (Skylake), 1 CPU, 8 logical and 4 physical cores - .NET Core SDK=3.1.200 - [Host] : .NET Core 3.1.2 (CoreCLR 4.700.20.6602, CoreFX 4.700.20.6702), X64 RyuJIT - Job-TLYXIR : .NET Framework 4.8 (4.8.4121.0), X64 RyuJIT - Job-HPKRXU : .NET Core 2.1.16 (CoreCLR 4.6.28516.03, CoreFX 4.6.28516.10), X64 RyuJIT - Job-OBFQMR : .NET Core 3.1.2 (CoreCLR 4.700.20.6602, CoreFX 4.700.20.6702), X64 RyuJIT - | Method | Runtime | TestImageLossy | TestImageLossless | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | - |--------------------------- |-------------- |--------------------- |--------------------- |----------:|----------:|---------:|-----------:|----------:|----------:|-------------:| - | 'Magick Lossy WebP' | .NET 4.7.2 | WebP/(...).webp [21] | WebP/(...).webp [24] | 70.37 ms | 9.234 ms | 0.506 ms | - | - | - | 32.05 KB | - | 'ImageSharp Lossy Webp' | .NET 4.7.2 | WebP/(...).webp [21] | WebP/(...).webp [24] | 211.77 ms | 8.055 ms | 0.442 ms | 19000.0000 | - | - | 82297.31 KB | - | 'Magick Lossless WebP' | .NET 4.7.2 | WebP/(...).webp [21] | WebP/(...).webp [24] | 49.35 ms | 1.099 ms | 0.060 ms | - | - | - | 15.32 KB | - | 'ImageSharp Lossless Webp' | .NET 4.7.2 | WebP/(...).webp [21] | WebP/(...).webp [24] | 494.34 ms | 5.505 ms | 0.302 ms | 2000.0000 | 1000.0000 | 1000.0000 | 151801.78 KB | - | 'Magick Lossy WebP' | .NET Core 2.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 70.21 ms | 1.440 ms | 0.079 ms | - | - | - | 14.8 KB | - | 'ImageSharp Lossy Webp' | .NET Core 2.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 142.32 ms | 6.046 ms | 0.331 ms | 9000.0000 | - | - | 40610.23 KB | - | 'Magick Lossless WebP' | .NET Core 2.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 49.44 ms | 0.258 ms | 0.014 ms | - | - | - | 14.3 KB | - | 'ImageSharp Lossless Webp' | .NET Core 2.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 206.45 ms | 11.093 ms | 0.608 ms | 2666.6667 | 1666.6667 | 1000.0000 | 151758.87 KB | - | 'Magick Lossy WebP' | .NET Core 3.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 69.69 ms | 1.147 ms | 0.063 ms | - | - | - | 14.42 KB | - | 'ImageSharp Lossy Webp' | .NET Core 3.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 121.72 ms | 2.373 ms | 0.130 ms | 9000.0000 | - | - | 40050.06 KB | - | 'Magick Lossless WebP' | .NET Core 3.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 49.37 ms | 1.865 ms | 0.102 ms | - | - | - | 14.27 KB | - | 'ImageSharp Lossless Webp' | .NET Core 3.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 194.03 ms | 37.759 ms | 2.070 ms | 2000.0000 | 1000.0000 | 1000.0000 | 151756.38 KB | + /* Results 15.05.2020 + * BenchmarkDotNet=v0.12.0, OS=Windows 10.0.18362 + Intel Core i7-6700K CPU 4.00GHz (Skylake), 1 CPU, 8 logical and 4 physical cores + .NET Core SDK=3.1.202 + [Host] : .NET Core 3.1.4 (CoreCLR 4.700.20.20201, CoreFX 4.700.20.22101), X64 RyuJIT + Job-AQFZAV : .NET Framework 4.8 (4.8.4180.0), X64 RyuJIT + Job-YCDAPQ : .NET Core 2.1.18 (CoreCLR 4.6.28801.04, CoreFX 4.6.28802.05), X64 RyuJIT + Job-WMTYOZ : .NET Core 3.1.4 (CoreCLR 4.700.20.20201, CoreFX 4.700.20.22101), X64 RyuJIT + + IterationCount=3 LaunchCount=1 WarmupCount=3 + | Method | Runtime | TestImageLossy | TestImageLossless | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | + |--------------------------- |-------------- |--------------------- |--------------------- |-----------:|----------:|--------:|----------:|----------:|------:|-------------:| + | 'Magick Lossy WebP' | .NET 4.7.2 | WebP/(...).webp [21] | WebP/(...).webp [24] | 125.2 ms | 7.93 ms | 0.43 ms | - | - | - | 18.05 KB | + | 'ImageSharp Lossy Webp' | .NET 4.7.2 | WebP/(...).webp [21] | WebP/(...).webp [24] | 1,102.1 ms | 67.88 ms | 3.72 ms | 2000.0000 | - | - | 11835.55 KB | + | 'Magick Lossless WebP' | .NET 4.7.2 | WebP/(...).webp [21] | WebP/(...).webp [24] | 183.6 ms | 7.11 ms | 0.39 ms | - | - | - | 18.71 KB | + | 'ImageSharp Lossless Webp' | .NET 4.7.2 | WebP/(...).webp [21] | WebP/(...).webp [24] | 1,820.1 ms | 68.66 ms | 3.76 ms | 4000.0000 | 1000.0000 | - | 223765.64 KB | + | 'Magick Lossy WebP' | .NET Core 2.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 124.7 ms | 1.92 ms | 0.11 ms | - | - | - | 15.97 KB | + | 'ImageSharp Lossy Webp' | .NET Core 2.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 739.0 ms | 39.51 ms | 2.17 ms | 2000.0000 | - | - | 11802.98 KB | + | 'Magick Lossless WebP' | .NET Core 2.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 184.0 ms | 21.65 ms | 1.19 ms | - | - | - | 17.96 KB | + | 'ImageSharp Lossless Webp' | .NET Core 2.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 618.3 ms | 16.33 ms | 0.90 ms | 4000.0000 | 1000.0000 | - | 223699.11 KB | + | 'Magick Lossy WebP' | .NET Core 3.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 125.6 ms | 17.51 ms | 0.96 ms | - | - | - | 16.1 KB | + | 'ImageSharp Lossy Webp' | .NET Core 3.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 768.4 ms | 114.73 ms | 6.29 ms | 2000.0000 | - | - | 11802.89 KB | + | 'Magick Lossless WebP' | .NET Core 3.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 183.6 ms | 3.32 ms | 0.18 ms | - | - | - | 17 KB | + | 'ImageSharp Lossless Webp' | .NET Core 3.1 | WebP/(...).webp [21] | WebP/(...).webp [24] | 621.3 ms | 12.12 ms | 0.66 ms | 4000.0000 | 1000.0000 | - | 223698.75 KB | */ } } diff --git a/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs b/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs index c10cd8d29..d5b17ad50 100644 --- a/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs +++ b/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs @@ -127,6 +127,11 @@ namespace SixLabors.ImageSharp.Tests.Formats { image.SaveAsTga(output); } + + using (FileStream output = File.OpenWrite(Path.Combine(path, $"{file.FileNameWithoutExtension}.webp"))) + { + image.SaveAsWebp(output); + } } } } @@ -174,6 +179,8 @@ namespace SixLabors.ImageSharp.Tests.Formats [InlineData(100, 100, "tga")] [InlineData(100, 10, "tga")] [InlineData(10, 100, "tga")] + [InlineData(100, 10, "webp")] + [InlineData(10, 100, "webp")] public void CanIdentifyImageLoadedFromBytes(int width, int height, string extension) { using (var image = Image.LoadPixelData(new Rgba32[width * height], width, height)) @@ -200,7 +207,7 @@ namespace SixLabors.ImageSharp.Tests.Formats [Fact] public void IdentifyReturnsNullWithInvalidStream() { - byte[] invalid = new byte[10]; + var invalid = new byte[10]; using (var memoryStream = new MemoryStream(invalid)) { diff --git a/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs b/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs index 98fbac7c0..684b75167 100644 --- a/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs +++ b/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs @@ -11,6 +11,7 @@ using SixLabors.ImageSharp.Formats.Gif; using SixLabors.ImageSharp.Formats.Jpeg; using SixLabors.ImageSharp.Formats.Png; using SixLabors.ImageSharp.Formats.Tga; +using SixLabors.ImageSharp.Formats.WebP; using SixLabors.ImageSharp.PixelFormats; using Xunit; @@ -36,12 +37,14 @@ namespace SixLabors.ImageSharp.Tests.Formats Assert.Equal(1, this.DefaultFormatsManager.ImageEncoders.Select(item => item.Value).OfType().Count()); Assert.Equal(1, this.DefaultFormatsManager.ImageEncoders.Select(item => item.Value).OfType().Count()); Assert.Equal(1, this.DefaultFormatsManager.ImageEncoders.Select(item => item.Value).OfType().Count()); + Assert.Equal(1, this.DefaultFormatsManager.ImageEncoders.Select(item => item.Value).OfType().Count()); Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType().Count()); Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType().Count()); Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType().Count()); Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType().Count()); Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType().Count()); + Assert.Equal(1, this.DefaultFormatsManager.ImageDecoders.Select(item => item.Value).OfType().Count()); } [Fact] diff --git a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs index 6e204e2d4..1caa4443a 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs @@ -9,6 +9,7 @@ using SixLabors.ImageSharp.Formats.Gif; using SixLabors.ImageSharp.Formats.Jpeg; using SixLabors.ImageSharp.Formats.Png; using SixLabors.ImageSharp.Formats.Tga; +using SixLabors.ImageSharp.Formats.WebP; using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs; namespace SixLabors.ImageSharp.Tests @@ -55,7 +56,8 @@ namespace SixLabors.ImageSharp.Tests var cfg = new Configuration( new JpegConfigurationModule(), new GifConfigurationModule(), - new TgaConfigurationModule()); + new TgaConfigurationModule(), + new WebPConfigurationModule()); // Magick codecs should work on all platforms IImageEncoder pngEncoder = IsWindows ? (IImageEncoder)SystemDrawingReferenceEncoder.Png : new PngEncoder(); diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs index e72d953ac..9e386e8f9 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs @@ -9,6 +9,7 @@ using SixLabors.ImageSharp.Formats.Bmp; using SixLabors.ImageSharp.Formats.Gif; using SixLabors.ImageSharp.Formats.Jpeg; using SixLabors.ImageSharp.Formats.Png; +using SixLabors.ImageSharp.Formats.WebP; using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs; using Xunit; @@ -81,6 +82,7 @@ namespace SixLabors.ImageSharp.Tests [InlineData("lol/Rofl.bmp", typeof(SystemDrawingReferenceDecoder))] [InlineData("lol/Baz.JPG", typeof(JpegDecoder))] [InlineData("lol/Baz.gif", typeof(GifDecoder))] + [InlineData("lol/foobar.webp", typeof(MagickReferenceDecoder))] public void GetReferenceDecoder_ReturnsCorrectDecoders_Windows(string fileName, Type expectedDecoderType) { if (TestEnvironment.IsLinux) @@ -97,6 +99,7 @@ namespace SixLabors.ImageSharp.Tests [InlineData("lol/Rofl.bmp", typeof(BmpEncoder))] [InlineData("lol/Baz.JPG", typeof(JpegEncoder))] [InlineData("lol/Baz.gif", typeof(GifEncoder))] + [InlineData("lol/foobar.webp", typeof(WebPEncoder))] public void GetReferenceEncoder_ReturnsCorrectEncoders_Linux(string fileName, Type expectedEncoderType) { if (!TestEnvironment.IsLinux) @@ -113,6 +116,7 @@ namespace SixLabors.ImageSharp.Tests [InlineData("lol/Rofl.bmp", typeof(MagickReferenceDecoder))] [InlineData("lol/Baz.JPG", typeof(JpegDecoder))] [InlineData("lol/Baz.gif", typeof(GifDecoder))] + [InlineData("lol/foobar.webp", typeof(MagickReferenceDecoder))] public void GetReferenceDecoder_ReturnsCorrectDecoders_Linux(string fileName, Type expectedDecoderType) { if (!TestEnvironment.IsLinux) diff --git a/tests/Images/Input/WebP/earth_lossless.webp b/tests/Images/Input/WebP/earth_lossless.webp index 8729ece9c..1abcb8668 100644 --- a/tests/Images/Input/WebP/earth_lossless.webp +++ b/tests/Images/Input/WebP/earth_lossless.webp @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1ea7fad78cd68e27c1616f4a99de52397f5485259c7adbd674a5c9a362885216 -size 2447273 +oid sha256:35e61613388342baac7f39a4a3c3ae32587a065505269115a134592eee9563b8 +size 7813062 diff --git a/tests/Images/Input/WebP/earth_lossy.webp b/tests/Images/Input/WebP/earth_lossy.webp index 8f1cebc3f..790a194de 100644 --- a/tests/Images/Input/WebP/earth_lossy.webp +++ b/tests/Images/Input/WebP/earth_lossy.webp @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:71263c0db7b8cd2e787b8554fd40aff1d46a753646fb2062966ca07ac040e841 -size 852402 +oid sha256:c45c068709fa3f878564d399e539636b9e42926291dde683adb7bb5d98c2c680 +size 467258