From 6dbde61f8df15651caa51f7d908f855de660d792 Mon Sep 17 00:00:00 2001 From: Ynse Hoornenborg Date: Mon, 29 Mar 2021 22:01:24 +0200 Subject: [PATCH] Rename JpegEncoder InitializeColorType method --- src/ImageSharp/Formats/Jpeg/JpegEncoder.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs index 6842cfe15..c4439b804 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs @@ -40,7 +40,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg where TPixel : unmanaged, IPixel { var encoder = new JpegEncoderCore(this); - this.EnrichColorType(); + this.InitializeColorType(); encoder.Encode(image, stream); } @@ -56,19 +56,21 @@ namespace SixLabors.ImageSharp.Formats.Jpeg where TPixel : unmanaged, IPixel { var encoder = new JpegEncoderCore(this); - this.EnrichColorType(); + this.InitializeColorType(); return encoder.EncodeAsync(image, stream, cancellationToken); } /// /// If ColorType was not set, set it based on the given . /// - private void EnrichColorType() + private void InitializeColorType() where TPixel : unmanaged, IPixel { if (this.ColorType == null) { - bool isGrayscale = typeof(TPixel) == typeof(L8) || typeof(TPixel) == typeof(L16); + bool isGrayscale = + typeof(TPixel) == typeof(L8) || typeof(TPixel) == typeof(L16) || + typeof(TPixel) == typeof(La16) || typeof(TPixel) == typeof(La32); this.ColorType = isGrayscale ? JpegColorType.Luminance : JpegColorType.YCbCr; } }