diff --git a/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs b/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs index 1b6330a3c..a5a45a684 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs @@ -166,22 +166,27 @@ namespace SixLabors.ImageSharp.Formats.Png { return PngColorType.GrayscaleWithAlpha; } + if (tPixel == typeof(Argb32)) { return PngColorType.RgbWithAlpha; } + if (tPixel == typeof(Rgb24)) { return PngColorType.Rgb; } + if (tPixel == typeof(Gray16)) { return PngColorType.Grayscale; } + if (tPixel == typeof(Gray8)) { return PngColorType.Grayscale; } + return default; } @@ -199,22 +204,27 @@ namespace SixLabors.ImageSharp.Formats.Png { return PngBitDepth.Bit8; } + if (tPixel == typeof(Argb32)) { return PngBitDepth.Bit8; } + if (tPixel == typeof(Rgb24)) { return PngBitDepth.Bit8; } + if (tPixel == typeof(Gray16)) { return PngBitDepth.Bit16; } + if (tPixel == typeof(Gray8)) { return PngBitDepth.Bit8; } + return default; } }