statiqdev / Statiq.Framework

A flexible and extensible static content generation framework for .NET.
https://statiq.dev/framework
MIT License
421 stars 74 forks source link

Feature Request: WebP support in Statiq.Images #250

Closed shmatt closed 1 year ago

shmatt commented 1 year ago

Lighthouse reports (available in Chromium Devtools) is used to anaylise optimisation of a web page.

A common suggestion it makes is to use modern image formats, including WebP. ImageSharp now supports WebP, making it trivial to add to Statiq.Images

   /// <summary>
    /// Outputs the image as WebP. This will override the default
    /// behavior of outputting the image as the same format.
    /// </summary>
    /// <returns>The current module instance.</returns>
    public MutateImage OutputAsWebp()
    {
        _operations.Peek().OutputActions.Add(
            new OutputAction((i, s) => i.SaveAsWebp(s), x => x.ChangeExtension(".webp")));
        return this;
    }

I can open a pull request if you prefer

daveaglick commented 1 year ago

I can open a pull request if you prefer

That would be fantastic :). I'd be happy to merge it in.

shmatt commented 1 year ago

Create PR

daveaglick commented 1 year ago

PR #253 merged in - I'll get a release out hopefully later this week, though possible the week after. Thanks!