statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.
https://statiq.dev/web
Other
1.66k stars 235 forks source link

Image.SetJpegQuality missing #794

Open jhgoodwin opened 5 years ago

jhgoodwin commented 5 years ago

In the documentation on the wyam website, and also in the Image module, there are references to SetJpegQuality, but this function was removed in https://github.com/Wyamio/Wyam/commit/b9c8b6d05d35576dbad12ad9b0404a7299c00911#diff-32ea30b39bc5a67b2c9f6c3e331a6b69

Was this removed as a mistake, or in the course of some other refactor that did not get updated documentation?

daveaglick commented 5 years ago

Looks like we lost it when converting from ImageProcessor to ImageSharp as part of the .NET Core/.NET Standard porting effort. There's a comment here about how that resulted in some breaking module changes. If I recall the API surface of ImageSharp wasn't quite the same as ImageProcessor. It's certainly possible those APIs have been added back to ImageSharp in one way or another by now - probably worth a revisit. I'll also mark this as a documentation issue.

featurequest commented 5 years ago

For those experiencing the same issue with this and are looking for the solution on how to do it with the new ImageSharp library you can do it this way.

using SixLabors.ImageSharp.Formats.Jpeg;

...
// Inside pipeline
Image()
    .OutputAs(
      (image, stream) => image.Save(stream, new JpegEncoder() {
        Quality = 75,
      }),
      path => path.ChangeExtension(".75.jpeg")
  ),
...