diff --git a/src/ImageSharp/Formats/Bmp/BmpFormat.cs b/src/ImageSharp/Formats/Bmp/BmpFormat.cs
index fb65f34d7..bd25eb9b7 100644
--- a/src/ImageSharp/Formats/Bmp/BmpFormat.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpFormat.cs
@@ -8,7 +8,7 @@ namespace ImageSharp.Formats
using System.Collections.Generic;
///
- /// Registers the image encoders, decoders and mime type detectors for the jpeg format.
+ /// Registers the image encoders, decoders and mime type detectors for the bmp format.
///
internal sealed class BmpFormat : IImageFormat
{
diff --git a/src/ImageSharp/Formats/Gif/GifFormat.cs b/src/ImageSharp/Formats/Gif/GifFormat.cs
index ea7b72d32..744aadff9 100644
--- a/src/ImageSharp/Formats/Gif/GifFormat.cs
+++ b/src/ImageSharp/Formats/Gif/GifFormat.cs
@@ -8,7 +8,7 @@ namespace ImageSharp.Formats
using System.Collections.Generic;
///
- /// Registers the image encoders, decoders and mime type detectors for the jpeg format.
+ /// Registers the image encoders, decoders and mime type detectors for the gif format.
///
internal sealed class GifFormat : IImageFormat
{
diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
index e6f19b915..467d41ff4 100644
--- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
@@ -825,14 +825,14 @@ namespace ImageSharp.Formats
using (var compressed = new Buffer(length))
{
// TODO: Should we use pack from vector here instead?
- this.From16BitTo8Bit(new Span(defilteredScanline), compressed, length);
- for (int x = pixelOffset, o = 1;
+ this.From16BitTo8Bit(new Span(defilteredScanline, 1), compressed, length);
+ for (int x = pixelOffset, o = 0;
x < this.header.Width;
- x += increment, o += this.bytesPerPixel)
+ x += increment, o += 3)
{
rgba.R = compressed[o];
- rgba.G = compressed[o + this.bytesPerSample];
- rgba.B = compressed[o + (2 * this.bytesPerSample)];
+ rgba.G = compressed[o + 1];
+ rgba.B = compressed[o + 2];
color.PackFromRgba32(rgba);
rowSpan[x] = color;
@@ -862,13 +862,13 @@ namespace ImageSharp.Formats
using (var compressed = new Buffer(length))
{
// TODO: Should we use pack from vector here instead?
- this.From16BitTo8Bit(new Span(defilteredScanline), compressed, length);
- for (int x = pixelOffset, o = 1; x < this.header.Width; x += increment, o += this.bytesPerPixel)
+ this.From16BitTo8Bit(new Span(defilteredScanline, 1), compressed, length);
+ for (int x = pixelOffset, o = 0; x < this.header.Width; x += increment, o += 4)
{
rgba.R = compressed[o];
- rgba.G = compressed[o + this.bytesPerSample];
- rgba.B = compressed[o + (2 * this.bytesPerSample)];
- rgba.A = compressed[o + (3 * this.bytesPerSample)];
+ rgba.G = compressed[o + 1];
+ rgba.B = compressed[o + 2];
+ rgba.A = compressed[o + 3];
color.PackFromRgba32(rgba);
rowSpan[x] = color;
diff --git a/src/ImageSharp/Formats/Png/PngFormat.cs b/src/ImageSharp/Formats/Png/PngFormat.cs
index 551b4a8c7..6df2aa7c5 100644
--- a/src/ImageSharp/Formats/Png/PngFormat.cs
+++ b/src/ImageSharp/Formats/Png/PngFormat.cs
@@ -8,7 +8,7 @@ namespace ImageSharp.Formats
using System.Collections.Generic;
///
- /// Registers the image encoders, decoders and mime type detectors for the jpeg format.
+ /// Registers the image encoders, decoders and mime type detectors for the png format.
///
internal sealed class PngFormat : IImageFormat
{
diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
index 6d82b5374..ee8a2ee55 100644
--- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
@@ -18,7 +18,7 @@ namespace ImageSharp.Tests
public static readonly string[] TestFiles =
{
TestImages.Png.Splash, TestImages.Png.Indexed, TestImages.Png.Interlaced, TestImages.Png.FilterVar,
- TestImages.Png.Bad.ChunkLength1, TestImages.Png.Bad.ChunkLength2, TestImages.Png.Rgb48Bpp
+ TestImages.Png.Bad.ChunkLength1, TestImages.Png.Bad.ChunkLength2, TestImages.Png.Rgb48Bpp, TestImages.Png.Rgb48BppInterlaced
};
[Theory]
diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs
index f35720f19..3479457cf 100644
--- a/tests/ImageSharp.Tests/TestImages.cs
+++ b/tests/ImageSharp.Tests/TestImages.cs
@@ -26,6 +26,7 @@ namespace ImageSharp.Tests
public const string SplashInterlaced = "Png/splash-interlaced.png";
public const string Interlaced = "Png/interlaced.png";
public const string Rgb48Bpp = "Png/rgb-48bpp.png";
+ public const string Rgb48BppInterlaced = "Png/rgb-48bpp-interlaced.png";
// Filtered test images from http://www.schaik.com/pngsuite/pngsuite_fil_png.html
public const string Filter0 = "Png/filter0.png";
diff --git a/tests/ImageSharp.Tests/TestImages/Formats/Png/rgb-48bpp-interlaced.png b/tests/ImageSharp.Tests/TestImages/Formats/Png/rgb-48bpp-interlaced.png
new file mode 100644
index 000000000..d19d44ea4
--- /dev/null
+++ b/tests/ImageSharp.Tests/TestImages/Formats/Png/rgb-48bpp-interlaced.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:79d1705ef6438d90dc145068141d4e32c1cf1cd5cf17c7b90b7ecb12967016bd
+size 69952