Prerequisites
I found this:
#672 (comment)
@jherby2k in our current design Image does not preserve the bit rate / color model of the original encoded data.
And this:
https://stackoverflow.com/questions/52407878/load-and-save-opaque-8-bit-png-files-using-imagesharp
Note. The png encoder by default will save the image in the input color type and bit depth. If you want to encode the image in a different color type you will need to new up an PngEncoder instance with the ColorType and BitDepth properties set.
Description
I am loading/resize an 8 bit png, however I want to save as .jpg
JpegEncoder does not have ColorType or BitDepth
Steps to Reproduce
Input Image:

private static void resizeUsingImageSharp(byte[] bytes, MemoryStream output)
{
var encoder = new JpegEncoder();
encoder.Quality = 10;
var decoder = new PngDecoder();
decoder.IgnoreMetadata = true;
var image = Image.Load<Gray8>(bytes, decoder);
image.Mutate(ctx => ctx.Resize(96, 96));
// Using .Grayscale() makes no difference, still saves 24 bit image
// encoder.Encode<Gray8>(image, output); also doesn't work
image.SaveAsJpeg(output, encoder);
}
Output Image:

System Configuration
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-dev002321" />
<PackageReference Include="SkiaSharp" Version="1.68.0" />
- Environment (Operating system, version and so on):
Window 10
- .NET Framework version:
netcoreapp3.0
- Additional information:
Prerequisites
DEBUGandRELEASEmodeI found this:
#672 (comment)
And this:
https://stackoverflow.com/questions/52407878/load-and-save-opaque-8-bit-png-files-using-imagesharp
Description
I am loading/resize an 8 bit png, however I want to save as .jpg
JpegEncoder does not have
ColorTypeorBitDepthSteps to Reproduce
Input Image:

Output Image:

System Configuration
Window 10
netcoreapp3.0