From 78c009f7e3412ba5a3f3fd20f159980601deb205 Mon Sep 17 00:00:00 2001 From: Valeriy Mironov Date: Sun, 26 Nov 2017 10:33:27 +0200 Subject: [PATCH] Fixed packing images with only one color --- Resources/ImageWriter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/ImageWriter.cs b/Resources/ImageWriter.cs index d17301b..66f351c 100644 --- a/Resources/ImageWriter.cs +++ b/Resources/ImageWriter.cs @@ -40,8 +40,8 @@ namespace Resources _paletteColors = (ushort) _palette.Count; _bitsPerPixel = (ushort) Math.Ceiling(Math.Log(_paletteColors, 2)); - if (_bitsPerPixel == 3) - _bitsPerPixel = 4; + if (_bitsPerPixel == 3) _bitsPerPixel = 4; + if (_bitsPerPixel == 0) _bitsPerPixel = 1; if (_bitsPerPixel != 1 && _bitsPerPixel != 2 && _bitsPerPixel != 4) throw new ArgumentException($"{0} bits per pixel doesn't supported.");