diff --git a/src/osgPlugins/png/ReaderWriterPNG.cpp b/src/osgPlugins/png/ReaderWriterPNG.cpp index 4ac82b8dd..53cb3b96f 100644 --- a/src/osgPlugins/png/ReaderWriterPNG.cpp +++ b/src/osgPlugins/png/ReaderWriterPNG.cpp @@ -229,7 +229,14 @@ class ReaderWriterPNG : public osgDB::ReaderWriter if (color == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png); if (color == PNG_COLOR_TYPE_GRAY && depth < 8) + { + #if PNG_LIBPNG_VER >= 10209 png_set_expand_gray_1_2_4_to_8(png); + #else + // use older now deprecated but identical call + png_set_gray_1_2_4_to_8(png); + #endif + } if (png_get_valid(png, info, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png);