diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index 4645f22e31..5e067aba57 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -163,11 +163,11 @@ namespace SixLabors.ImageSharp.Formats.Png /// The type of the pixel. /// The cloned image where the transparent pixels will be changed. private static void ClearTransparentPixels(Image image) - where TPixel : unmanaged, IPixel - { + where TPixel : unmanaged, IPixel => image.ProcessPixelRows(accessor => { Rgba32 rgba32 = default; + Rgba32 transparent = Color.Transparent; for (int y = 0; y < accessor.Height; y++) { Span span = accessor.GetRowSpan(y); @@ -177,14 +177,12 @@ namespace SixLabors.ImageSharp.Formats.Png if (rgba32.A == 0) { - span[x].FromRgba32(Color.Transparent); + span[x].FromRgba32(transparent); } } } }); - } - /// /// Creates the quantized image and sets calculates and sets the bit depth. ///