From 1da5cf4251951bd2246038270c6249a6c8f5ec97 Mon Sep 17 00:00:00 2001 From: Tristan Matthews Date: Fri, 13 Mar 2015 13:23:45 -0500 Subject: [PATCH] rdpng: convert 16-bit input to 8-bit This is instead of assuming 8-bit input and producing borked images. --- rdpng.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rdpng.c b/rdpng.c index fef8aee5..34ac3081 100644 --- a/rdpng.c +++ b/rdpng.c @@ -76,6 +76,10 @@ start_input_png (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) cinfo->in_color_space = JCS_RGB; cinfo->input_components = 3; } + + if (bit_depth == 16) + png_set_strip_16(source->png_ptr); + cinfo->data_precision = 8; cinfo->image_width = width; cinfo->image_height = height;