From ca7a49c06399e61c26093e7e13e5190d7d0ec807 Mon Sep 17 00:00:00 2001 From: shmatt Date: Thu, 1 Dec 2022 05:54:59 +0000 Subject: [PATCH] Upgraded SixLabours.ImageSharp in Statiq.Images Added OutputAsWebp to MutateImage --- src/extensions/Statiq.Images/MutateImage.cs | 12 ++++++++++++ src/extensions/Statiq.Images/Statiq.Images.csproj | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/extensions/Statiq.Images/MutateImage.cs b/src/extensions/Statiq.Images/MutateImage.cs index a8a27b0f..ac882146 100644 --- a/src/extensions/Statiq.Images/MutateImage.cs +++ b/src/extensions/Statiq.Images/MutateImage.cs @@ -112,6 +112,18 @@ public MutateImage OutputAsBmp() return this; } + /// + /// Outputs the image as WebP. This will override the default + /// behavior of outputting the image as the same format. + /// + /// The current module instance. + public MutateImage OutputAsWebp() + { + _operations.Peek().OutputActions.Add( + new OutputAction((i, s) => i.SaveAsWebp(s), x => x.ChangeExtension(".webp"))); + return this; + } + /// /// Allows you to specify an alternate output format for the image. /// For example, you might use this if you want to full specify the encoder and it's properties. diff --git a/src/extensions/Statiq.Images/Statiq.Images.csproj b/src/extensions/Statiq.Images/Statiq.Images.csproj index 9d25ca4e..b588603c 100644 --- a/src/extensions/Statiq.Images/Statiq.Images.csproj +++ b/src/extensions/Statiq.Images/Statiq.Images.csproj @@ -4,7 +4,7 @@ Statiq Static StaticContent StaticSite Blog BlogEngine Images ImageProcessor - +