--- grass-6.4.1/raster/r.out.png/r.out.png.c +++ grass-6.4.1/raster/r.out.png/r.out.png.c @@ -261,9 +261,11 @@ int main(int argc, char *argv[]) png_info_init(info_ptr); #endif png_init_io(png_ptr, fp); +#if PNG_LIBPNG_VER < 10500 /* 1.5.0 */ info_ptr->width = win.cols; info_ptr->height = win.rows; info_ptr->bit_depth = depth; +#endif /* explicit filter-type (or none) required */ if ((filter >= 0) && (filter <= 4)) { @@ -302,10 +304,18 @@ int main(int argc, char *argv[]) /*if(!gscale->answer){ *//* 24BIT COLOR IMAGE */ if (TRUE) { + int color_type; if (do_alpha) - info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA; + color_type = PNG_COLOR_TYPE_RGB_ALPHA; else - info_ptr->color_type = PNG_COLOR_TYPE_RGB; + color_type = PNG_COLOR_TYPE_RGB; +#if PNG_LIBPNG_VER < 10500 /* 1.5.0 */ + info_ptr->color_type = color_type; +#else + png_set_IHDR(png_ptr, info_ptr, win.cols, win.rows, depth, + color_type, PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); +#endif /* write the png-info struct */ png_write_info(png_ptr, info_ptr);