From 00abb57ffacb4966e92285be02cf3b2bfbcebe29 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Wed, 22 Feb 2012 22:46:35 +0000 Subject: [PATCH] add missing image_width fix --- include/mapnik/png_io.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mapnik/png_io.hpp b/include/mapnik/png_io.hpp index 4ea2abc78..c46f509c2 100644 --- a/include/mapnik/png_io.hpp +++ b/include/mapnik/png_io.hpp @@ -487,7 +487,7 @@ void save_as_png8(T1 & file, T2 const& image, T3 const & tree, else { // <=16 colors -> write 4-bit color depth PNG - unsigned image_width = (int(0.5*width) + 3)&~3; + unsigned image_width = width > 3 ? (int(0.5*width) + 3)&~3 : 4; unsigned image_height = height; image_data_8 reduced_image(image_width, image_height); for (unsigned y = 0; y < height; ++y)