From 4339f69da43823a4743ed2bf09fcc5735ba2edec Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Sat, 11 Dec 2010 18:05:50 +0000 Subject: [PATCH] fix opencv-highgui build with old versions of libpng (< 1.4.x) --- modules/highgui/src/grfmt_png.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/highgui/src/grfmt_png.cpp b/modules/highgui/src/grfmt_png.cpp index c9b4b54e9e..1e2a267769 100644 --- a/modules/highgui/src/grfmt_png.cpp +++ b/modules/highgui/src/grfmt_png.cpp @@ -223,8 +223,12 @@ bool PngDecoder::readData( Mat& img ) png_set_palette_to_rgb( png_ptr ); if( m_color_type == PNG_COLOR_TYPE_GRAY && m_bit_depth < 8 ) +#if PNG_LIBPNG_VER_MAJOR*100 + PNG_LIBPNG_VER_MINOR >= 104 png_set_expand_gray_1_2_4_to_8( png_ptr ); - +#else + png_set_gray_1_2_4_to_8( png_ptr ); +#endif + if( CV_MAT_CN(m_type) > 1 && color ) png_set_bgr( png_ptr ); // convert RGB to BGR else if( color )