Browse Source

Fix for off by one for indexed pngs

pull/167/head
Scott Williams 9 years ago
committed by GitHub
parent
commit
67c54e4adf
  1. 6
      src/ImageSharp/Formats/Png/PngDecoderCore.cs

6
src/ImageSharp/Formats/Png/PngDecoderCore.cs

@ -579,7 +579,7 @@ namespace ImageSharp.Formats
// channel and we should try to read it. // channel and we should try to read it.
for (int x = 0; x < this.header.Width; x++) for (int x = 0; x < this.header.Width; x++)
{ {
int index = newScanline[x]; int index = newScanline[x + 1];
int pixelOffset = index * 3; int pixelOffset = index * 3;
byte a = this.paletteAlpha.Length > index ? this.paletteAlpha[index] : (byte)255; 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++) for (int x = 0; x < this.header.Width; x++)
{ {
int index = newScanline[x]; int index = newScanline[x + 1];
int pixelOffset = index * 3; int pixelOffset = index * 3;
byte r = this.palette[pixelOffset]; byte r = this.palette[pixelOffset];
@ -982,4 +982,4 @@ namespace ImageSharp.Formats
} }
} }
} }
} }

Loading…
Cancel
Save