Statiq.Web icon indicating copy to clipboard operation
Statiq.Web copied to clipboard

Image.SetJpegQuality missing

Open jhgoodwin opened this issue 5 years ago • 2 comments

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?

jhgoodwin avatar Mar 13 '19 22:03 jhgoodwin

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.

daveaglick avatar Mar 14 '19 12:03 daveaglick

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")
  ),
...

featurequest avatar Apr 27 '19 22:04 featurequest