From 524d7e847e195b833131ee5b6ee21f5d67dbdacb Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Thu, 6 Apr 2017 09:27:40 +0100 Subject: [PATCH] Fix for off by one for indexed pngs --- src/ImageSharp/Formats/Png/PngDecoderCore.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index d6529940e..5ce9b5eb0 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -579,7 +579,7 @@ namespace ImageSharp.Formats // channel and we should try to read it. for (int x = 0; x < this.header.Width; x++) { - int index = newScanline[x]; + int index = newScanline[x + 1]; int pixelOffset = index * 3; byte a = this.paletteAlpha.Length > index ? this.paletteAlpha[index] : (byte)255; @@ -603,7 +603,7 @@ namespace ImageSharp.Formats { for (int x = 0; x < this.header.Width; x++) { - int index = newScanline[x]; + int index = newScanline[x + 1]; int pixelOffset = index * 3; byte r = this.palette[pixelOffset]; @@ -982,4 +982,4 @@ namespace ImageSharp.Formats } } } -} \ No newline at end of file +}