From 9577246907dee54b92ef1137d4095bee60842663 Mon Sep 17 00:00:00 2001 From: andreichuk <2353790+andreichuk@users.noreply.github.com> Date: Sat, 7 May 2022 22:46:41 +0300 Subject: [PATCH] fixed the main buffer's size --- src/QoiSharp/QoiEncoder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QoiSharp/QoiEncoder.cs b/src/QoiSharp/QoiEncoder.cs index 05ef113..adf98e0 100644 --- a/src/QoiSharp/QoiEncoder.cs +++ b/src/QoiSharp/QoiEncoder.cs @@ -32,7 +32,7 @@ public static byte[] Encode(QoiImage image) byte colorSpace = (byte)image.ColorSpace; byte[] pixels = image.Data; - byte[] bytes = new byte[QoiCodec.HeaderSize + QoiCodec.Padding.Length + (width * height * channels)]; + byte[] bytes = new byte[QoiCodec.HeaderSize + QoiCodec.Padding.Length + (width * height * (channels + 1))]; bytes[0] = (byte)(QoiCodec.Magic >> 24); bytes[1] = (byte)(QoiCodec.Magic >> 16);