--- src/pngread.cc.orig	2009-06-07 20:45:04.000000000 +1000
+++ src/pngread.cc	2012-03-29 03:02:05.000000000 +1100
@@ -207,7 +207,7 @@ canvas *load_canvas(char *filename)
   /* Set error handling */
   if (setjmp(png_jmpbuf(png_ptr))) {
       error("pngread: libpng exited abnormally");
-      png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
+      png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
       fclose(infile);
       return NULL;
   }
@@ -229,7 +229,7 @@ canvas *load_canvas(char *filename)
       png_set_palette_to_rgb(png_ptr);
   }
   if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
-      png_set_gray_1_2_4_to_8(png_ptr); // this function deprecated need to be redone
+      png_set_expand_gray_1_2_4_to_8(png_ptr);
       bit_depth=8;
       info_ptr->bit_depth=bit_depth;
   }
--- src/pngwrite.cc.orig	2009-06-07 20:45:04.000000000 +1000
+++ src/pngwrite.cc	2012-03-29 02:55:33.000000000 +1100
@@ -126,7 +126,7 @@ void save_canvas(canvas *can,char *filen
   if (!info_ptr) {
       fclose(fp);
       error("pngwrite: cannot not create image structure");
-      png_destroy_write_struct(&png_ptr, png_infopp_NULL);
+      png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
       return;
   }
 
