-
-
Notifications
You must be signed in to change notification settings - Fork 890
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp
- I have verified if the problem exist in both
DEBUGandRELEASEmode - I have searched open and closed issues to ensure it has not already been reported
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
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);
}
System Configuration
- ImageSharp version:
<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:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

