diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index bca1d0033f..ab6d09348c 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -317,8 +317,7 @@ namespace ImageSharp.Formats where TPacked : struct { // We can use the optimized PixelAccessor here and copy the bytes in unmanaged memory. - int bpp = this.bytesPerPixel; - using (PixelRow pixelRow = new PixelRow(this.width, rawScanline, bpp == 4 ? ComponentOrder.XYZW : ComponentOrder.XYZ)) + using (PixelRow pixelRow = new PixelRow(this.width, rawScanline, this.bytesPerPixel == 4 ? ComponentOrder.XYZW : ComponentOrder.XYZ)) { pixels.CopyTo(pixelRow, row); }