Compatibility with libpng 1.5 and later. --- libgcode/gcode_image.c.orig 2010-07-23 10:15:13.000000000 -0500 +++ libgcode/gcode_image.c 2019-05-29 06:27:52.000000000 -0500 @@ -260,8 +260,8 @@ png_read_info (png_ptr, info_ptr); - image->res[0] = info_ptr->width; - image->res[1] = info_ptr->height; + image->res[0] = png_get_image_width (png_ptr, info_ptr); + image->res[1] = png_get_image_height (png_ptr, info_ptr); /* printf ("image size: %dx%d\n", image->res[0], image->res[1]); */ @@ -274,16 +274,16 @@ row_pointers = (png_bytep *) malloc (sizeof (png_bytep) * image->res[1]); for (y = 0; y < image->res[1]; y++) - row_pointers[y] = (png_byte*) malloc (info_ptr->rowbytes); + row_pointers[y] = (png_byte*) malloc (png_get_rowbytes (png_ptr, info_ptr)); png_read_image (png_ptr, row_pointers); image->dmap = (gfloat_t *) malloc (sizeof (gfloat_t) * image->res[0] * image->res[1]); incr = 1; - if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) + if (png_get_color_type (png_ptr, info_ptr) & PNG_COLOR_MASK_COLOR) incr = 3; - if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) + if (png_get_color_type (png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA) incr = 4; for (y = 0; y < image->res[1]; y++)