Imported from libpng-1.2.9beta1.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index e40b94a..d4684e8 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,32 +1,38 @@
 
-Libpng 1.2.8 - December 3, 2004
+Libpng 1.2.9beta1 - February 21, 2006
 
-This is a public release of libpng, intended for use in production codes.
+This is not intended to be a public release.  It will be replaced
+within a few weeks by a public version or by another test version.
 
-Changes since the last public release (1.2.7):
+Changes since the last public release (1.2.8):
 
-  Fixed bug in png_text_compress() that would fail to complete a large block.
-  Fixed bug, introduced in libpng-1.2.7, that overruns a buffer during
-    strip alpha operation in png_do_strip_filler().
-  Added PNG_1_2_X definition in pngconf.h
-  #ifdef out png_info_init in png.c and png_read_init in pngread.c (as of 1.3.0)
-  Reduce color_type to a nonalpha type after strip alpha operation in
-    png_do_strip_filler().
-  Revised definitions of PNG_MAX_UINT_32, PNG_MAX_SIZE, and PNG_MAXSUM
-  Fixed (again) definition of PNG_LIBPNG_VER_DLLNUM in png.h (Cosmin).
-  Added PNG_LIBPNG_BUILD_PRIVATE in png.h (Cosmin).
-  Set png_ptr->zstream.data_type to Z_BINARY, to avoid unnecessary detection
-    of data type in deflate (Cosmin).
-  Deprecated but continue to support SPECIALBUILD and PRIVATEBUILD in favor of
-    PNG_LIBPNG_BUILD_SPECIAL_STRING and PNG_LIBPNG_BUILD_PRIVATE_STRING.
-  Despammed mailing addresses by masking "@" with "at".
-  Added scripts/makefile.elf with supporting code in pngconf.h for symbol
-    versioning (John Bowler).
-  Added projects/visualc71 (Simon-pierre).
+version 1.2.9beta1 [February 21, 2006]
+  Initialized some structure members in pngwutil.c to avoid gcc-4.0.0 complaints
+  Revised man page and libpng.txt to make it clear that one should not call
+    png_read_end or png_write_end after png_read_png or png_write_png.
+  Updated references to png-mng-implement mailing list.
+  Fixed an incorrect typecast in pngrutil.c
+  Added PNG_READ_SUPPORTED conditionals for making a write-only library.
+  Added PNG_NO_WRITE_INTERLACING_SUPPORTED conditional.
+  Optimized alpha-inversion loops in pngwtran.c
+  Moved test for nonzero gamma outside of png_build_gamma_table() in pngrtran.c
+  Make sure num_trans is <= 256 before copying data in png_set_tRNS().
+  Make sure num_palette is <= 256 before copying data in png_set_PLTE().
+  Interchanged order of write_swap_alpha and write_invert_alpha transforms.
+  Added parentheses in the definition of PNG_LIBPNG_BUILD_TYPE (Cosmin).
+  Optimized zlib window flag (CINFO) in contrib/pngsuite/*.png (Cosmin).
+  Updated scripts/makefile.bc32 for Borland C++ 5.6 (Cosmin).
+  Fixed inconsistency in definition of png_default_read_data()
+  Exported png_get_uint_32, png_save_uint_32, png_get_uint_16, png_save_uint_16,
+    png_get_int_32, png_save_int_32, png_get_uint_31 (Cosmin).
+  Added parentheses in the definition of PNG_LIBPNG_BUILD_TYPE (Cosmin).
+  Updated scripts/pngos2.def, scripts/pngw32.def (Cosmin).
+  Added type cast (png_byte) in png_write_sCAL() (Cosmin).
+  Fixed scripts/makefile.cygwin (Cosmin).
 
-Send comments/corrections/commendations to
-png-implement at ccrc.wustl.edu (subscription required; write to
-majordomo at ccrc.wustl.edu with "subscribe png-implement" in the message)
-or to glennrp at users.sourceforge.net
+Send comments/corrections/commendations to png-mng-implement at lists.sf.net
+(subscription required; visit 
+https://lists.sourceforge.net/lists/listinfo/png-mng-implement
+to subscribe) or to glennrp at users.sourceforge.net
 
 Glenn R-P
diff --git a/CHANGES b/CHANGES
index 90c816e..fb52647 100644
--- a/CHANGES
+++ b/CHANGES
@@ -10,7 +10,7 @@
   split up pngwrite.c to several files
   added pnglib.txt
   added example.c
-  cleaned up writer, adding a few new tranformations
+  cleaned up writer, adding a few new transformations
   fixed some bugs in writer
   interfaced with zlib 0.5
   added K&R support
@@ -22,7 +22,7 @@
   created png_color_16 and png_color_8 to handle color needs
   cleaned up color type defines
   fixed various bugs
-  made various names more consistant
+  made various names more consistent
   interfaced with zlib 0.71
   cleaned up zTXt reader and writer (using zlib's Reset functions)
   split transformations into pngrtran.c and pngwtran.c
@@ -151,7 +151,7 @@
   added "packswap" transformation, which changes the endianness of
      packed-pixel bytes (Kevin Bracey)
   added "strip_alpha" transformation, which removes the alpha channel of
-     input images without using it (not neccesarily a good idea)
+     input images without using it (not necessarily a good idea)
   added "swap_alpha" transformation, which puts the alpha channel in front
      of the color bytes instead of after
   removed all implicit variable tests which assume NULL == 0 (I think)
@@ -172,7 +172,7 @@
   more chunk types tested in pngtest.c
   renamed pngrcb.c to pngset.c, and all png_read_<chunk> functions to be
      png_set_<chunk>.  We now have corresponding png_get_<chunk>
-     functions in pngget.c to get infomation in info_ptr.  This isolates
+     functions in pngget.c to get information in info_ptr.  This isolates
      the application from the internal organization of png_info_struct
      (good for shared library implementations).
 
@@ -522,9 +522,9 @@
   Updated scripts/makevms.com and added makevms.com to contrib/gregbook
     and contrib/pngminus (Martin Zinser)
 version 1.0.5c [November 26, 1999]
-  Moved png_get_header_version from png.h to png.c, to accomodate ansi2knr.
+  Moved png_get_header_version from png.h to png.c, to accommodate ansi2knr.
   Removed all global arrays (according to PNG_NO_GLOBAL_ARRAYS macro), to
-    accomodate making DLL's: Moved usr_png_ver from global variable to function
+    accommodate making DLL's: Moved usr_png_ver from global variable to function
     png_get_header_ver() in png.c.  Moved png_sig to png_sig_bytes in png.c and
     eliminated use of png_sig in pngwutil.c.  Moved the various png_CHNK arrays
     into pngtypes.h.  Eliminated use of global png_pass arrays.  Declared the
@@ -1361,6 +1361,7 @@
   Added png_set_add_alpha() that updates color type.
 version 1.0.17rc1 and 1.2.7rc1 [September 4, 2004]
   Revised png_set_strip_filler() to not remove alpha if color_type has alpha.
+
 version 1.0.17 and 1.2.7 [September 12, 2004]
   Added makefile.hp64
   Changed projects/msvc/png32ms.def to scripts/png32ms.def in makefile.cygwin
@@ -1408,12 +1409,42 @@
   Added projects/visualc7 (Simon-pierre).
 version 1.2.8rc5 [November 29, 2004]
   Fixed new typo in scripts/pngw32.rc
+
 version 1.2.8 [December 3, 2004]
   Removed projects/visualc7, added projects/visualc71.
 
-Send comments/corrections/commendations to
-png-implement at ccrc.wustl.edu (subscription required; write to
-majordomo at ccrc.wustl.edu with "subscribe png-implement" in the message)
+version 1.2.9beta1 [February 21, 2006]
+
+  Initialized some structure members in pngwutil.c to avoid gcc-4.0.0 complaints
+  Revised man page and libpng.txt to make it clear that one should not call
+    png_read_end or png_write_end after png_read_png or png_write_png.
+  Updated references to png-mng-implement mailing list.
+  Fixed an incorrect typecast in pngrutil.c
+  Added PNG_READ_SUPPORTED conditionals for making a write-only library.
+  Added PNG_NO_WRITE_INTERLACING_SUPPORTED conditional.
+  Optimized alpha-inversion loops in pngwtran.c
+  Moved test for nonzero gamma outside of png_build_gamma_table() in pngrtran.c
+  Make sure num_trans is <= 256 before copying data in png_set_tRNS().
+  Make sure num_palette is <= 256 before copying data in png_set_PLTE().
+  Interchanged order of write_swap_alpha and write_invert_alpha transforms.
+  Added parentheses in the definition of PNG_LIBPNG_BUILD_TYPE (Cosmin).
+  Optimized zlib window flag (CINFO) in contrib/pngsuite/*.png (Cosmin).
+  Updated scripts/makefile.bc32 for Borland C++ 5.6 (Cosmin).
+  Fixed inconsistency in definition of png_default_read_data()
+  Exported png_get_uint_32, png_save_uint_32, png_get_uint_16, png_save_uint_16,
+    png_get_int_32, png_save_int_32, png_get_uint_31 (Cosmin).
+  Added parentheses in the definition of PNG_LIBPNG_BUILD_TYPE (Cosmin).
+  Updated scripts/pngos2.def, scripts/pngw32.def (Cosmin).
+  Added type cast (png_byte) in png_write_sCAL() (Cosmin).
+  Fixed scripts/makefile.cygwin (Cosmin).
+
+version 1.3.0beta1 [future]
+  Enable iTXt support (changes png_struct, thus requires so-number change).
+
+Send comments/corrections/commendations to png-mng-implement at lists.sf.net
+(subscription required; visit
+https://lists.sourceforge.net/lists/listinfo/png-mng-implement
+to subscribe)
 or to glennrp at users.sourceforge.net
 
 Glenn R-P
diff --git a/INSTALL b/INSTALL
index 28de5aa..6d3e326 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
 
-Installing libpng version 1.2.8 - %DATE%
+Installing libpng version 1.2.9beta1 - February 21, 2006
 
 Before installing libpng, you must first install zlib.  zlib
 can usually be found wherever you got libpng.  zlib can be
@@ -10,8 +10,8 @@
 version of zlib that's installed.
 
 You can rename the directories that you downloaded (they
-might be called "libpng-1.2.8" or "lpng109" and "zlib-1.1.3"
-or "zlib113") so that you have directories called "zlib" and "libpng".
+might be called "libpng-1.2.9beta1" or "lpng109" and "zlib-1.2.1"
+or "zlib121") so that you have directories called "zlib" and "libpng".
 
 Your directory structure should look like this:
 
@@ -23,14 +23,13 @@
           *.c
           contrib
              gregbook
-             msvctest
              pngminus
              pngsuite
              visupng
           projects
              beos
-             borland
-             msvc
+             c5builder (Borland)
+             visualc6 (msvc)
              netware.txt
              wince.txt
           scripts
@@ -48,13 +47,16 @@
 distribution of libpng.  It is available in both tar.gz (UNIX style line
 endings) and zip (DOS style line endings) formats.
 
-If you are building libpng with MSVC, you can enter the libpng\msvc directory
-and follow the instructions in msvc\README.txt.
 
-You can build libpng for WindowsCE by entering the downloading and installing
-the libpng\wince directory as instructed in the projects\wince.txt file, and
+If you are building libpng with MSVC, you can enter the
+libpng projects\visualc6 directory and follow the instructions in
+projects\visualc6\README.txt.
+
+You can build libpng for WindowsCE by downloading and installing
+the projects\wince directory as instructed in the projects\wince.txt file, and
 then following the instructions in the README* files.  Similarly, you can
-build libpng for Netware as instructed in projects\netware.txt.
+build libpng for Netware or Beos as instructed in projects\netware.txt
+or projects\beos.
 
 Else enter the zlib directory and follow the instructions in zlib/README,
 then come back here and choose the appropriate makefile.sys in the scripts
@@ -64,8 +66,12 @@
 include
 
  makefile.std      =>  Generic UNIX makefile (cc, creates static libpng.a)
- makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng%SONAME%.so.%SONUM%.1.2.8)
- makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng%SONAME%.so.%SONUM%.1.2.8,
+ makefile.elf      =>  Linux/ELF makefile symbol versioning,
+                       gcc, creates libpng12.so.0.1.2.9beta1)
+ makefile.linux    =>  Linux/ELF makefile
+                       (gcc, creates libpng12.so.0.1.2.9beta1)
+ makefile.gcmmx    =>  Linux/ELF makefile
+                       (gcc, creates libpng12.so.0.1.2.9beta1,
                        uses assembler code tuned for Intel MMX platform)
  makefile.gcc      =>  Generic makefile (gcc, creates static libpng.a)
  makefile.knr      =>  Archaic UNIX Makefile that converts files with
@@ -73,23 +79,27 @@
                        ftp://ftp.cs.wisc.edu/ghost)
  makefile.aix      =>  AIX/gcc makefile
  makefile.cygwin   =>  Cygwin/gcc makefile
- makefile.darwin   =>  Darwin makefile
+ makefile.darwin   =>  Darwin makefile, can use on MacosX
  makefile.dec      =>  DEC Alpha UNIX makefile
- makefile.hpgcc    =>  FreeBSD makefile
+ makefile.freebsd  =>  FreeBSD makefile
  makefile.hpgcc    =>  HPUX makefile using gcc
  makefile.hpux     =>  HPUX (10.20 and 11.00) makefile
+ makefile.hp64     =>  HPUX (10.20 and 11.00) makefile, 64-bit
  makefile.ibmc     =>  IBM C/C++ version 3.x for Win32 and OS/2 (static)
  makefile.intel    =>  Intel C/C++ version 4.0 and later
  libpng.icc        =>  Project file for IBM VisualAge/C++ version 4.0 or later
- makefile.macosx   =>  MACOS X Makefile
  makefile.netbsd   =>  NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
- makefile.ne%SONUM%bsd  =>  NetBSD/cc makefile, uses PNGGCCRD, makes libpng%SONUM%.so
+ makefile.ne12bsd  =>  NetBSD/cc makefile, uses PNGGCCRD,
+                       makes libpng12.so
  makefile.openbsd  =>  OpenBSD makefile
  makefile.sgi      =>  Silicon Graphics IRIX makefile (cc, creates static lib)
- makefile.sggcc    =>  Silicon Graphics (gcc, creates libpng%SONAME%.so.%SONUM%.1.2.8)
+ makefile.sggcc    =>  Silicon Graphics (gcc,
+                       creates libpng12.so.0.1.2.9beta1)
  makefile.sunos    =>  Sun makefile
- makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng%SONAME%.so.%SONUM%.1.2.8)
- makefile.so9      =>  Solaris 9 makefile (gcc, creates libpng%SONAME%.so.%SONUM%.1.2.8)
+ makefile.solaris  =>  Solaris 2.X makefile (gcc,
+                       creates libpng12.so.0.1.2.9beta1)
+ makefile.so9      =>  Solaris 9 makefile (gcc,
+                       creates libpng12.so.0.1.2.9beta1)
  makefile.32sunu   =>  Sun Ultra 32-bit makefile
  makefile.64sunu   =>  Sun Ultra 64-bit makefile
  makefile.sco      =>  For SCO OSr5  ELF and Unixware 7 with Native cc
@@ -102,7 +112,6 @@
  makefile.beos     =>  BEOS makefile for X86
  makefile.bor      =>  Borland makefile (uses bcc)
  makefile.bc32     =>  32-bit Borland C++ (all modules compiled in C mode)
- makefile.bd32     =>  To make a png32bd.dll with Borland C++ 4.5
  makefile.tc3      =>  Turbo C 3.0 makefile
  makefile.dj2      =>  DJGPP 2 makefile
  makefile.msc      =>  Microsoft C makefile
@@ -115,7 +124,6 @@
  makefile.watcom   =>  Watcom 10a+ Makefile, 32-bit flat memory model
  makevms.com       =>  VMS build script
  descrip.mms       =>  VMS makefile for MMS or MMK
- pngdef.pas        =>  Defines for a png32bd.dll with Borland C++ 4.5
  SCOPTIONS.ppc     =>  Used with smakefile.ppc
 
 Copy the file (or files) that you need from the
@@ -130,13 +138,13 @@
 Then read pngconf.h to see if you want to make any configuration
 changes.
 
-Then just run "make test" which will create the libpng library in
-this directory and run a quick test that reads the "pngtest.png"
-file and writes a "pngout.png" file that should be identical to it.
-Look for "9782 zero samples" in the output of the test.  For more
-confidence, you can run another test by typing "pngtest pngnow.png"
-and looking for "289 zero samples" in the output.  Also, you can
-run "pngtest -m *.png" in the "contrib/pngsuite" directory and compare
+Then just run "make" which will create the libpng library in
+this directory and "make test" which will run a quick test that reads
+the "pngtest.png" file and writes a "pngout.png" file that should be
+identical to it.  Look for "9782 zero samples" in the output of the
+test.  For more confidence, you can run another test by typing
+"pngtest pngnow.png" and looking for "289 zero samples" in the output.
+Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
 your output with the result shown in contrib/pngsuite/README.
 
 Most of the makefiles will allow you to run "make install" to
@@ -145,9 +153,20 @@
 Some also allow you to run "make test-installed" after you have
 run "make install".
 
+If you encounter a compiler error message complaining about the
+lines
+      __png.h__ already includes setjmp.h;
+      __dont__ include it again.;
+This means you have compiled another module that includes setjmp.h,
+which is hazardous because the two modules might not include exactly
+the same setjmp.h.  If you are sure that you know what you are doing
+and that they are exactly the same, then you can comment out or
+delete the two lines.  Better yet, use the cexcept interface
+instead, as demonstrated in contrib/visupng of the libpng distribution.
+
 Further information can be found in the README and libpng.txt
-files, in the individual makefiles, in png.h, in the README files in
-subdirectories of the LIB directory, and the manual pages libpng.3 and png.5.
+files, in the individual makefiles, in png.h, and the manual pages
+libpng.3 and png.5.
 
 
 Using the ./configure script -- 16 December 2002.
diff --git a/INSTALL.a b/INSTALL.a
new file mode 100644
index 0000000..b0ba189
--- /dev/null
+++ b/INSTALL.a
@@ -0,0 +1,20 @@
+
+
+Using the ./configure script -- 16 December 2002.
+=================================================
+
+
+The ./configure script should work compatibly with what scripts/makefile.*
+did, however there are some options you need to add to configure explicitly,
+which previously was done semi-automatically (if you didn't edit
+scripts/makefile.* yourself, that is)
+
+
+CFLAGS="-Wall -O3 -funroll-loops \
+-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
+--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
+
+You can alternatively specify --includedir=/usr/include, /usr/local/include,
+/usr/include/png12, or whatever.
+
+
diff --git a/KNOWNBUG b/KNOWNBUG
index 620296f..7017877 100644
--- a/KNOWNBUG
+++ b/KNOWNBUG
@@ -1,5 +1,5 @@
 
-Known bugs in libpng version 1.2.8
+Known bugs in libpng version 1.2.9beta1
 
 1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
    reading interlaced PNG files, when assembler code is enabled but running
diff --git a/LICENSE b/LICENSE
index fe3ac4b..a2109b3 100644
--- a/LICENSE
+++ b/LICENSE
@@ -8,8 +8,8 @@
 If you modify libpng you may insert additional notices immediately following
 this sentence.
 
-libpng version 1.2.6, December 3, 2004, is
-Copyright (c) 2004 Glenn Randers-Pehrson, and is
+libpng versions 1.2.6, August 15, 2004, through 1.2.9beta1, February 21, 2006, are
+Copyright (c) 2005 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
 
@@ -106,4 +106,4 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-December 3, 2004
+February 21, 2006
diff --git a/Makefile.am b/Makefile.am
index 027be06..9e0c4d4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,8 +15,10 @@
 	pngwtran.c pngmem.c pngerror.c pngpread.c \
 	png.h pngconf.h 
 libpng_la_SOURCES = $(libpng12_la_SOURCES)
-libpng12_la_LDFLAGS = -export-dynamic -version-info $(LIBPNG12_VERSION_INFO)
-libpng_la_LDFLAGS = -export-dynamic -version-info $(LIBPNG3_VERSION_INFO)
+libpng12_la_LDFLAGS = -no-undefined -export-dynamic -version-info \
+$(LIBPNG12_VERSION_INFO)
+libpng_la_LDFLAGS = -no-undefined -export-dynamic -version-info \
+$(LIBPNG3_VERSION_INFO)
 
 #distribute headers in /usr/include/libpng/*
 pkginclude_HEADERS= png.h pngconf.h
@@ -24,7 +26,8 @@
 #extra source distribution files.
 EXTRA_DIST= ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
 	pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
-	${srcdir}/projects/cbuilder5/* ${srcdir}/projects/beos/* ${srcdir}/projects/visualc6/* \
+	${srcdir}/projects/cbuilder5/* ${srcdir}/projects/beos/* \
+	${srcdir}/projects/visualc6/* ${srcdir}/projects/visualc71 \
 	${srcdir}/projects/wince.txt ${srcdir}/projects/netware.txt \
 	${srcdir}/scripts/* \
 	${srcdir}/contrib/gregbook/* \
diff --git a/README b/README
index 06f9fe4..6a3623b 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng version 1.2.8 - December 3, 2004 (shared library 12.0)
+README for libpng version 1.2.9beta1 - February 21, 2006 (shared library 12.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
@@ -103,9 +103,10 @@
 This release was created and will be supported by myself (of course
 based in a large way on Guy's and Andreas' earlier work), and the PNG group.
 
-glennrp at users.sourceforge.net
-png-implement at ccrc.wustl.edu (subscription required; write to
-majordomo at ccrc.wustl.edu with "subscribe png-implement" in the message).
+Send comments/corrections/commendations to png-mng-implement at lists.sf.net
+(subscription required; visit 
+https://lists.sourceforge.net/lists/listinfo/png-mng-implement
+to subscribe) or to glennrp at users.sourceforge.net
 
 You can't reach Guy, the original libpng author, at the addresses
 given in previous versions of this document.  He and Andreas will read mail
@@ -189,11 +190,11 @@
        descrip.mms      =>  VMS makefile for MMS or MMK
        makefile.std     =>  Generic UNIX makefile (cc, creates static libpng.a)
        makefile.elf     =>  Linux/ELF makefile symbol versioning,
-                            gcc, creates libpng12.so.0.1.2.8)
+                            gcc, creates libpng12.so.0.1.2.9beta1)
        makefile.linux   =>  Linux/ELF makefile
-                            (gcc, creates libpng12.so.0.1.2.8)
+                            (gcc, creates libpng12.so.0.1.2.9beta1)
        makefile.gcmmx   =>  Linux/ELF makefile
-                            (gcc, creates libpng12.so.0.1.2.8,
+                            (gcc, creates libpng12.so.0.1.2.9beta1,
                             uses assembler code tuned for Intel MMX platform)
        makefile.gcc     =>  Generic makefile (gcc, creates static libpng.a)
        makefile.knr     =>  Archaic UNIX Makefile that converts files with
@@ -215,12 +216,12 @@
        makefile.openbsd =>  OpenBSD makefile
        makefile.sgi     =>  Silicon Graphics IRIX (cc, creates static lib)
        makefile.sggcc   =>  Silicon Graphics
-                            (gcc, creates libpng12.so.0.1.2.8)
+                            (gcc, creates libpng12.so.0.1.2.9beta1)
        makefile.sunos   =>  Sun makefile
        makefile.solaris =>  Solaris 2.X makefile
-                            (gcc, creates libpng12.so.0.1.2.8)
+                            (gcc, creates libpng12.so.0.1.2.9beta1)
        makefile.so9     =>  Solaris 9 makefile
-                            (gcc, creates libpng12.so.0.1.2.8)
+                            (gcc, creates libpng12.so.0.1.2.9beta1)
        makefile.32sunu  =>  Sun Ultra 32-bit makefile
        makefile.64sunu  =>  Sun Ultra 64-bit makefile
        makefile.sco     =>  For SCO OSr5  ELF and Unixware 7 with Native cc
diff --git a/Y2KINFO b/Y2KINFO
index 4db294f..772122f 100644
--- a/Y2KINFO
+++ b/Y2KINFO
@@ -1,13 +1,13 @@
    Y2K compliance in libpng:
    =========================
 
-      December 3, 2004
+      February 21, 2006
 
       Since the PNG Development group is an ad-hoc body, we can't make
       an official declaration.
 
       This is your unofficial assurance that libpng from version 0.71 and
-      upward through 1.2.8 are Y2K compliant.  It is my belief that earlier
+      upward through 1.2.9beta1 are Y2K compliant.  It is my belief that earlier
       versions were also Y2K compliant.
 
       Libpng only has three year fields.  One is a 2-byte unsigned integer
diff --git a/configure b/configure
index 4d2a80c..e8ff7a7 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.57 for libpng 1.2.8-automake.
+# Generated by GNU Autoconf 2.57 for libpng 1.2.9beta1-automake.
 #
 # Report bugs to <png-implement@ccrc.wustl.edu>.
 #
@@ -427,8 +427,8 @@
 # Identity of this package.
 PACKAGE_NAME='libpng'
 PACKAGE_TARNAME='libpng'
-PACKAGE_VERSION='1.2.8-automake'
-PACKAGE_STRING='libpng 1.2.8-automake'
+PACKAGE_VERSION='1.2.9beta1-automake'
+PACKAGE_STRING='libpng 1.2.9beta1-automake'
 PACKAGE_BUGREPORT='png-implement@ccrc.wustl.edu'
 
 ac_unique_file="pngget.c"
@@ -938,7 +938,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libpng 1.2.8-automake to adapt to many kinds of systems.
+\`configure' configures libpng 1.2.9beta1-automake to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1008,7 +1008,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libpng 1.2.8-automake:";;
+     short | recursive ) echo "Configuration of libpng 1.2.9beta1-automake:";;
    esac
   cat <<\_ACEOF
 
@@ -1106,7 +1106,7 @@
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-libpng configure 1.2.8-automake
+libpng configure 1.2.9beta1-automake
 generated by GNU Autoconf 2.57
 
 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
@@ -1121,7 +1121,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libpng $as_me 1.2.8-automake, which was
+It was created by libpng $as_me 1.2.9beta1-automake, which was
 generated by GNU Autoconf 2.57.  Invocation command line was
 
   $ $0 $@
@@ -1721,7 +1721,7 @@
 
 # Define the identity of the package.
  PACKAGE=libpng
- VERSION=1.2.8-automake
+ VERSION=1.2.9beta1-automake
 
 
 cat >>confdefs.h <<_ACEOF
@@ -9673,7 +9673,7 @@
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by libpng $as_me 1.2.8-automake, which was
+This file was extended by libpng $as_me 1.2.9beta1-automake, which was
 generated by GNU Autoconf 2.57.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -9736,7 +9736,7 @@
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-libpng config.status 1.2.8-automake
+libpng config.status 1.2.9beta1-automake
 configured by $0, generated by GNU Autoconf 2.57,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/configure.ac b/configure.ac
index 0dff105..bd3e6cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 # Process this file with autoconf to produce a configure script.
-m4_define(PNGPKG_VERSION,[1.2.8-automake])
+m4_define(PNGPKG_VERSION,[1.2.9beta1-automake])
 AC_INIT([libpng], PNGPKG_VERSION, png-implement@ccrc.wustl.edu)
 AM_INIT_AUTOMAKE([libpng], PNGPKG_VERSION)
 AC_CONFIG_SRCDIR([pngget.c])
diff --git a/contrib/pngsuite/basn0g01.png b/contrib/pngsuite/basn0g01.png
index 1d72242..e31e1c7 100644
--- a/contrib/pngsuite/basn0g01.png
+++ b/contrib/pngsuite/basn0g01.png
Binary files differ
diff --git a/contrib/pngsuite/basn0g02.png b/contrib/pngsuite/basn0g02.png
index 5083324..68809dd 100644
--- a/contrib/pngsuite/basn0g02.png
+++ b/contrib/pngsuite/basn0g02.png
Binary files differ
diff --git a/contrib/pngsuite/basn0g04.png b/contrib/pngsuite/basn0g04.png
index 0bf3687..6fa089c 100644
--- a/contrib/pngsuite/basn0g04.png
+++ b/contrib/pngsuite/basn0g04.png
Binary files differ
diff --git a/contrib/pngsuite/basn0g08.png b/contrib/pngsuite/basn0g08.png
index 23c8237..bf522ee 100644
--- a/contrib/pngsuite/basn0g08.png
+++ b/contrib/pngsuite/basn0g08.png
Binary files differ
diff --git a/contrib/pngsuite/basn0g16.png b/contrib/pngsuite/basn0g16.png
index e7c82f7..318ebca 100644
--- a/contrib/pngsuite/basn0g16.png
+++ b/contrib/pngsuite/basn0g16.png
Binary files differ
diff --git a/contrib/pngsuite/basn2c08.png b/contrib/pngsuite/basn2c08.png
index db5ad15..21d2f91 100644
--- a/contrib/pngsuite/basn2c08.png
+++ b/contrib/pngsuite/basn2c08.png
Binary files differ
diff --git a/contrib/pngsuite/basn2c16.png b/contrib/pngsuite/basn2c16.png
index 50c1cb9..1bd4a4d 100644
--- a/contrib/pngsuite/basn2c16.png
+++ b/contrib/pngsuite/basn2c16.png
Binary files differ
diff --git a/contrib/pngsuite/basn3p01.png b/contrib/pngsuite/basn3p01.png
index b145c2b..a21db59 100644
--- a/contrib/pngsuite/basn3p01.png
+++ b/contrib/pngsuite/basn3p01.png
Binary files differ
diff --git a/contrib/pngsuite/basn3p02.png b/contrib/pngsuite/basn3p02.png
index 8985b3d..1d0ab61 100644
--- a/contrib/pngsuite/basn3p02.png
+++ b/contrib/pngsuite/basn3p02.png
Binary files differ
diff --git a/contrib/pngsuite/basn3p04.png b/contrib/pngsuite/basn3p04.png
index 0fbf9e8..6dc6eac 100644
--- a/contrib/pngsuite/basn3p04.png
+++ b/contrib/pngsuite/basn3p04.png
Binary files differ
diff --git a/contrib/pngsuite/basn3p08.png b/contrib/pngsuite/basn3p08.png
index 0ddad07..0e07f48 100644
--- a/contrib/pngsuite/basn3p08.png
+++ b/contrib/pngsuite/basn3p08.png
Binary files differ
diff --git a/contrib/pngsuite/basn4a08.png b/contrib/pngsuite/basn4a08.png
index 3e13052..3bb0dd0 100644
--- a/contrib/pngsuite/basn4a08.png
+++ b/contrib/pngsuite/basn4a08.png
Binary files differ
diff --git a/contrib/pngsuite/basn4a16.png b/contrib/pngsuite/basn4a16.png
index 8243644..6dbee9f 100644
--- a/contrib/pngsuite/basn4a16.png
+++ b/contrib/pngsuite/basn4a16.png
Binary files differ
diff --git a/contrib/pngsuite/basn6a08.png b/contrib/pngsuite/basn6a08.png
index e608738..6106230 100644
--- a/contrib/pngsuite/basn6a08.png
+++ b/contrib/pngsuite/basn6a08.png
Binary files differ
diff --git a/contrib/pngsuite/basn6a16.png b/contrib/pngsuite/basn6a16.png
index 984a995..a9bf3cb 100644
--- a/contrib/pngsuite/basn6a16.png
+++ b/contrib/pngsuite/basn6a16.png
Binary files differ
diff --git a/libpng.3 b/libpng.3
index 1feceee..55fc8ad 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "December 3, 2004"
+.TH LIBPNG 3 "February 21, 2006"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.8
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.9beta1
 .SH SYNOPSIS
 \fI\fB
 
@@ -781,10 +781,10 @@
 .SH LIBPNG.TXT
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.2.8 - December 3, 2004
+ libpng version 1.2.9beta1 - February 21, 2006
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
- Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ Copyright (c) 1998-2005 Glenn Randers-Pehrson
  For conditions of distribution and use, see copyright
  notice in png.h.
 
@@ -2029,8 +2029,8 @@
 
 .SS Finishing a sequential read
 
-After you are finished reading the image through either the high- or
-low-level interfaces, you can finish reading the file.  If you are
+After you are finished reading the image through the
+low-level interface, you can finish reading the file.  If you are
 interested in comments or time, which may be stored either before or
 after the image data, you should pass the separate png_info struct if
 you want to keep the comments from before and after the image
@@ -3240,7 +3240,7 @@
 If you need to read or write custom chunks, you may need to get deeper
 into the libpng code.  The library now has mechanisms for storing
 and writing chunks of unknown type; you can even declare callbacks
-for custom chunks.  Hoewver, this may not be good enough if the
+for custom chunks.  However, this may not be good enough if the
 library code itself needs to know about interactions between your
 chunk and existing `intrinsic' chunks.
 
@@ -3685,13 +3685,13 @@
 
 .SH IX. Y2K Compliance in libpng
 
-December 3, 2004
+February 21, 2006
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
 
 This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.2.8 are Y2K compliant.  It is my belief that earlier
+upward through 1.2.9beta1 are Y2K compliant.  It is my belief that earlier
 versions were also Y2K compliant.
 
 Libpng only has three year fields.  One is a 2-byte unsigned integer that
@@ -3844,6 +3844,7 @@
  1.2.8rc1-5          13    10208  12.so.0.1.2.8rc1-5
  1.0.18              10    10018  12.so.0.1.0.18
  1.2.8               13    10208  12.so.0.1.2.8
+ 1.3.0beta1          14    10300  13.so.0.1.3.0beta1
 
 Henceforth the source version will match the shared-library minor
 and patch numbers; the shared-library major version number will be
@@ -3899,14 +3900,17 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.2.8 - December 3, 2004:
+Libpng version 1.2.9beta1 - February 21, 2006:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
 
 Supported by the PNG development group
 .br
-png-implement at ccrc.wustl.edu (subscription required; write to
-majordomo at ccrc.wustl.edu with "subscribe png-implement" in the message).
+png-mng-implement at lists.sf.net
+(subscription required; visit
+png-implement at ccrc.wustl.edu (subscription required; visit
+https://lists.sourceforge.net/lists/listinfo/png-mng-implement
+to subscribe).
 
 .SH COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
 
@@ -3917,8 +3921,8 @@
 If you modify libpng you may insert additional notices immediately following
 this sentence.
 
-libpng version 1.2.6, December 3, 2004, is
-Copyright (c) 2004 Glenn Randers-Pehrson, and is
+libpng versions 1.2.6, August 15, 2004, through 1.2.9beta1, February 21, 2006, are
+Copyright (c) 2005 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
 
@@ -4016,7 +4020,7 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-December 3, 2004
+February 21, 2006
 
 .\" end of man page
 
diff --git a/libpng.txt b/libpng.txt
index 9360f33..cb478c4 100644
--- a/libpng.txt
+++ b/libpng.txt
@@ -1,9 +1,9 @@
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.2.8 - December 3, 2004
+ libpng version 1.2.9beta1 - February 21, 2006
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
- Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ Copyright (c) 1998-2005 Glenn Randers-Pehrson
  For conditions of distribution and use, see copyright
  notice in png.h.
 
@@ -1248,8 +1248,8 @@
 
 Finishing a sequential read
 
-After you are finished reading the image through either the high- or
-low-level interfaces, you can finish reading the file.  If you are
+After you are finished reading the image through the
+low-level interface, you can finish reading the file.  If you are
 interested in comments or time, which may be stored either before or
 after the image data, you should pass the separate png_info struct if
 you want to keep the comments from before and after the image
@@ -2459,7 +2459,7 @@
 If you need to read or write custom chunks, you may need to get deeper
 into the libpng code.  The library now has mechanisms for storing
 and writing chunks of unknown type; you can even declare callbacks
-for custom chunks.  Hoewver, this may not be good enough if the
+for custom chunks.  However, this may not be good enough if the
 library code itself needs to know about interactions between your
 chunk and existing `intrinsic' chunks.
 
@@ -2904,13 +2904,13 @@
 
 IX. Y2K Compliance in libpng
 
-December 3, 2004
+February 21, 2006
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
 
 This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.2.8 are Y2K compliant.  It is my belief that earlier
+upward through 1.2.9beta1 are Y2K compliant.  It is my belief that earlier
 versions were also Y2K compliant.
 
 Libpng only has three year fields.  One is a 2-byte unsigned integer that
diff --git a/libpngpf.3 b/libpngpf.3
index d196d70..7072ee5 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 "December 3, 2004"
+.TH LIBPNGPF 3 "February 21, 2006"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.8
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.9beta1
 (private functions)
 .SH SYNOPSIS
 \fB\fB#include <png.h>\fP\fP
diff --git a/png.5 b/png.5
index db7c834..f725a5a 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "December 3, 2004"
+.TH PNG 5 "February 21, 2006"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
@@ -58,7 +58,7 @@
 
 .SH COPYRIGHT NOTICE
 .LP
-This man page is Copyright (c) 1998-2004 Glenn Randers-Pehrson.  See png.h
+This man page is Copyright (c) 1998-2005 Glenn Randers-Pehrson.  See png.h
 for conditions of use and distribution.
 .LP
 The PNG Specification (Second Edition) is
diff --git a/png.c b/png.c
index 608ea2c..8e92337 100644
--- a/png.c
+++ b/png.c
@@ -1,9 +1,9 @@
 
 /* png.c - location for general purpose libpng functions
  *
- * libpng version 1.2.8 - December 3, 2004
+ * libpng version 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  */
@@ -13,7 +13,7 @@
 #include "png.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_8 Your_png_h_is_not_version_1_2_8;
+typedef version_1_2_9beta1 Your_png_h_is_not_version_1_2_9beta1;
 
 /* Version information for C files.  This had better match the version
  * string defined in png.h.  */
@@ -22,9 +22,12 @@
 /* png_libpng_ver was changed to a function in version 1.0.5c */
 const char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING;
 
+#ifdef PNG_READ_SUPPORTED
+
 /* png_sig was changed to a function in version 1.0.5c */
 /* Place to hold the signature string for a PNG file. */
 const png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
+#endif /* PNG_READ_SUPPORTED */
 
 /* Invoke global declarations for constant strings for known chunk types */
 PNG_IHDR;
@@ -49,6 +52,7 @@
 PNG_tRNS;
 PNG_zTXt;
 
+#ifdef PNG_READ_SUPPORTED
 /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
 
 /* start of interlace block */
@@ -80,6 +84,7 @@
 const int FARDATA png_pass_dsp_mask[]
    = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
 
+#endif /* PNG_READ_SUPPORTED */
 #endif /* PNG_USE_GLOBAL_ARRAYS */
 
 /* Tells libpng that we have already handled the first "num_bytes" bytes
@@ -88,6 +93,7 @@
  * or write any of the magic bytes before it starts on the IHDR.
  */
 
+#ifdef PNG_READ_SUPPORTED
 void PNGAPI
 png_set_sig_bytes(png_structp png_ptr, int num_bytes)
 {
@@ -113,10 +119,10 @@
    if (num_to_check > 8)
       num_to_check = 8;
    else if (num_to_check < 1)
-      return (0);
+      return (-1);
 
    if (start > 7)
-      return (0);
+      return (-1);
 
    if (start + num_to_check > 8)
       num_to_check = 8 - start;
@@ -124,6 +130,7 @@
    return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check)));
 }
 
+#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
 /* (Obsolete) function to check signature bytes.  It does not allow one
  * to check a partial signature.  This function might be removed in the
  * future - use png_sig_cmp().  Returns true (nonzero) if the file is a PNG.
@@ -133,7 +140,10 @@
 {
   return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num));
 }
+#endif
+#endif /* PNG_READ_SUPPORTED */
 
+#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
 /* Function to allocate memory for zlib and clear it to 0. */
 #ifdef PNG_1_0_X
 voidpf PNGAPI
@@ -592,6 +602,7 @@
 
    png_info_init_3(&info_ptr, png_sizeof(png_info));
 }
+#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
 
 /* This function returns a pointer to the io_ptr associated with the user
  * functions.  The application should free any memory associated with this
@@ -603,6 +614,7 @@
    return (png_ptr->io_ptr);
 }
 
+#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
 #if !defined(PNG_NO_STDIO)
 /* Initialize the default input/output functions for the PNG file.  If you
  * use your own read or write routines, you can call either png_set_read_fn()
@@ -675,13 +687,14 @@
    return ((png_bytep)"\211\120\116\107\015\012\032\012");
 }
 #endif
+#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
 
 png_charp PNGAPI
 png_get_copyright(png_structp png_ptr)
 {
    if (&png_ptr != NULL)  /* silence compiler warning about unused png_ptr */
-   return ((png_charp) "\n libpng version 1.2.8 - December 3, 2004\n\
-   Copyright (c) 1998-2004 Glenn Randers-Pehrson\n\
+   return ((png_charp) "\n libpng version 1.2.9beta1 - February 21, 2006\n\
+   Copyright (c) 1998-2006 Glenn Randers-Pehrson\n\
    Copyright (c) 1996-1997 Andreas Dilger\n\
    Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
    return ((png_charp) "");
@@ -722,6 +735,7 @@
    return ((png_charp) "");
 }
 
+#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
 #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
 int PNGAPI
 png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
@@ -745,6 +759,7 @@
 {
    return (inflateReset(&png_ptr->zstream));
 }
+#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
 
 /* This function was added to libpng-1.0.7 */
 png_uint_32 PNGAPI
@@ -755,6 +770,7 @@
 }
 
 
+#if defined(PNG_READ_SUPPORTED)
 #if !defined(PNG_1_0_X)
 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
     /* GRR:  could add this:   && defined(PNG_MMX_CODE_SUPPORTED) */
@@ -814,7 +830,9 @@
 }
 #endif
 #endif /* PNG_1_0_X */
+#endif /* PNG_READ_SUPPORTED */
 
+#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
 #ifdef PNG_SIZE_T
 /* Added at libpng version 1.2.6 */
    PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
@@ -826,3 +844,4 @@
   return ((png_size_t)size);
 }
 #endif /* PNG_SIZE_T */
+#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
diff --git a/png.h b/png.h
index e87a301..1cc08aa 100644
--- a/png.h
+++ b/png.h
@@ -1,14 +1,14 @@
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.2.8 - December 3, 2004
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * libpng version 1.2.9beta1 - February 21, 2006
+ * Copyright (c) 1998-2005 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * Authors and maintainers:
  *  libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  *  libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- *  libpng versions 0.97, January 1998, through 1.2.8 - December 3, 2004: Glenn
+ *  libpng versions 0.97, January 1998, through 1.2.9beta1 - February 21, 2006: Glenn
  *  See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -111,6 +111,7 @@
  *    1.2.8rc1-5              13    10208  12.so.0.1.2.8rc1-5
  *    1.0.18                  10    10018  12.so.0.1.0.18
  *    1.2.8                   13    10208  12.so.0.1.2.8
+ *    1.3.0beta1              14    10300  13.so.0.1.3.0beta1
  *
  *    Henceforth the source version will match the shared-library major
  *    and minor numbers; the shared-library major version number will be
@@ -140,8 +141,8 @@
  * If you modify libpng you may insert additional notices immediately following
  * this sentence.
  *
- * libpng versions 1.2.6, August 15, 2004, through 1.2.8, December 3, 2004, are
- * Copyright (c) 2004 Glenn Randers-Pehrson, and are
+ * libpng versions 1.2.6, August 15, 2004, through 1.2.9beta1, February 21, 2006, are
+ * Copyright (c) 2005 Glenn Randers-Pehrson, and are
  * distributed according to the same disclaimer and license as libpng-1.2.5
  * with the following individual added to the list of Contributing Authors:
  *
@@ -252,13 +253,13 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    December 3, 2004
+ *    February 21, 2006
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
  *
  *    This is your unofficial assurance that libpng from version 0.71 and
- *    upward through 1.2.8 are Y2K compliant.  It is my belief that earlier
+ *    upward through 1.2.9beta1 are Y2K compliant.  It is my belief that earlier
  *    versions were also Y2K compliant.
  *
  *    Libpng only has three year fields.  One is a 2-byte unsigned integer
@@ -314,9 +315,9 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.8"
+#define PNG_LIBPNG_VER_STRING "1.2.9beta1"
 #define PNG_HEADER_VERSION_STRING \
-   " libpng version 1.2.8 - December 3, 2004 (header)\n"
+   " libpng version 1.2.9beta1 - February 21, 2006 (header)\n"
 
 #define PNG_LIBPNG_VER_SONUM   0
 #define PNG_LIBPNG_VER_DLLNUM  13
@@ -324,11 +325,11 @@
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   2
-#define PNG_LIBPNG_VER_RELEASE 8
+#define PNG_LIBPNG_VER_RELEASE 9
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
 
-#define PNG_LIBPNG_VER_BUILD  0
+#define PNG_LIBPNG_VER_BUILD  1
 
 /* Release Status */
 #define PNG_LIBPNG_BUILD_ALPHA    1
@@ -345,14 +346,14 @@
 #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
                                        PNG_LIBPNG_BUILD_PRIVATE */
 
-#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
+#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
 
 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
  * We must not include leading zeros.
  * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release */
-#define PNG_LIBPNG_VER 10208 /* 1.2.8 */
+#define PNG_LIBPNG_VER 10209 /* 1.2.9 */
 
 #ifndef PNG_VERSION_INFO_ONLY
 /* include the compression library's header */
@@ -376,14 +377,14 @@
  */
 
 #if defined(PNG_USER_PRIVATEBUILD)
-#  define PNG_LIBPNG_BUILD_TYPE PNG_LIBPNG_BUILD_BASE_TYPE | \
-          PNG_LIBPNG_BUILD_PRIVATE
+#  define PNG_LIBPNG_BUILD_TYPE \
+          (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
 #else
 #  if defined(PNG_LIBPNG_SPECIALBUILD)
-#    define PNG_LIBPNG_BUILD_TYPE PNG_LIBPNG_BUILD_BASE_TYPE | \
-            PNG_LIBPNG_BUILD_SPECIAL
+#    define PNG_LIBPNG_BUILD_TYPE \
+            (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
 #  else
-#    define PNG_LIBPNG_BUILD_TYPE PNG_LIBPNG_BUILD_BASE_TYPE
+#    define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)
 #  endif
 #endif
 
@@ -894,8 +895,10 @@
 #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
 #define PNG_UINT_32_MAX ((png_uint_32)(-1))
 #define PNG_SIZE_MAX ((png_size_t)(-1))
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 /* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */
 #define PNG_MAX_UINT PNG_UINT_31_MAX
+#endif
 
 /* These describe the color_type field in png_info. */
 /* color type masks */
@@ -1356,7 +1359,7 @@
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  */
-typedef png_structp version_1_2_8;
+typedef png_structp version_1_2_9beta1;
 
 typedef png_struct FAR * FAR * png_structpp;
 
@@ -2572,6 +2575,44 @@
 
 #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
 
+/* Inline macros to do direct reads of bytes from the input buffer.  These
+ * require that you are using an architecture that uses PNG byte ordering
+ * (MSB first) and supports unaligned data storage.  I think that PowerPC
+ * in big-endian mode and 680x0 are the only ones that will support this.
+ * The x86 line of processors definitely do not.  The png_get_int_32()
+ * routine also assumes we are using two's complement format for negative
+ * values, which is almost certainly true.
+ */
+#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
+#  define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
+#  define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
+#  define png_get_int_32(buf)  ( *((png_int_32p)  (buf)))
+#else
+extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));
+extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf));
+extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf));
+#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
+extern PNG_EXPORT(png_uint_32,png_get_uint_31)
+  PNGARG((png_structp png_ptr, png_bytep buf));
+/* No png_get_int_16 -- may be added if there's a real need for it. */
+
+/* Place a 32-bit number into a buffer in PNG byte order (big-endian).
+ */
+extern PNG_EXPORT(void,png_save_uint_32)
+   PNGARG((png_bytep buf, png_uint_32 i));
+extern PNG_EXPORT(void,png_save_int_32)
+   PNGARG((png_bytep buf, png_int_32 i));
+
+/* Place a 16-bit number into a buffer in PNG byte order.
+ * The parameter is declared unsigned int, not png_uint_16,
+ * just to avoid potential problems on pre-ANSI C compilers.
+ */
+extern PNG_EXPORT(void,png_save_uint_16)
+   PNGARG((png_bytep buf, unsigned int i));
+/* No png_save_int_16 -- may be added if there's a real need for it. */
+
+/* ************************************************************************* */
+
 /* These next functions are used internally in the code.  They generally
  * shouldn't be used unless you are writing code to add or replace some
  * functionality in libpng.  More information about most functions can
@@ -2762,31 +2803,7 @@
 PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5];
 #endif /* PNG_USE_GLOBAL_ARRAYS */
 
-
-/* Inline macros to do direct reads of bytes from the input buffer.  These
- * require that you are using an architecture that uses PNG byte ordering
- * (MSB first) and supports unaligned data storage.  I think that PowerPC
- * in big-endian mode and 680x0 are the only ones that will support this.
- * The x86 line of processors definitely do not.  The png_get_int_32()
- * routine also assumes we are using two's complement format for negative
- * values, which is almost certainly true.
- */
-#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
-#  if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED)
-#    define png_get_int_32(buf) ( *((png_int_32p) (buf)))
-#  endif
-#  define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
-#  define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
-#else
-#  if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED)
-PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf));
-#  endif
-PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
-PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
-#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
-PNG_EXTERN png_uint_32 png_get_uint_31 PNGARG((png_structp png_ptr,
-  png_bytep buf));
-
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 /* Initialize png_ptr struct for reading, and allocate any other memory.
  * (old interface - DEPRECATED - use png_create_read_struct instead).
  */
@@ -2794,11 +2811,14 @@
 #undef png_read_init
 #define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
     PNG_LIBPNG_VER_STRING,  png_sizeof(png_struct));
+#endif
 extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
     png_const_charp user_png_ver, png_size_t png_struct_size));
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
     png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
     png_info_size));
+#endif
 
 /* Initialize png_ptr struct for writing, and allocate any other memory.
  * (old interface - DEPRECATED - use png_create_write_struct instead).
@@ -2906,23 +2926,6 @@
 PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
 #endif
 
-
-/* Place a 32-bit number into a buffer in PNG byte order (big-endian).
- * The only currently known PNG chunks that use signed numbers are
- * the ancillary extension chunks, oFFs and pCAL.
- */
-PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
-
-#if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
-PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i));
-#endif
-
-/* Place a 16-bit number into a buffer in PNG byte order.
- * The parameter is declared unsigned int, not png_uint_16,
- * just to avoid potential problems on pre-ANSI C compilers.
- */
-PNG_EXTERN void png_save_uint_16 PNGARG((png_bytep buf, unsigned int i));
-
 /* simple function to write the signature */
 PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
 
diff --git a/pngconf.h b/pngconf.h
index ba50838..d7223a1 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,9 +1,9 @@
 
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng version 1.2.8 - December 3, 2004
+ * libpng version 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2005 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  */
@@ -453,18 +453,22 @@
  */
 
 /* The size of the png_text structure changed in libpng-1.0.6 when
- * iTXt is supported.  It is turned off by default, to support old apps
- * that malloc the png_text structure instead of calling png_set_text()
- * and letting libpng malloc it.  It will be turned on by default in
- * libpng-1.3.0.
+ * iTXt support was added.  iTXt support was turned off by default through
+ * libpng-1.2.x, to support old apps that malloc the png_text structure
+ * instead of calling png_set_text() and letting libpng malloc it.  It
+ * was turned on by default in libpng-1.3.0.
  */
 
-#ifndef PNG_iTXt_SUPPORTED
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+#  define PNG_NO_iTXt_SUPPORTED
+#endif
+
+#if !defined(PNG_NO_iTXt_SUPPORTED)
 #  if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
-#    define PNG_NO_READ_iTXt
+#    define PNG_READ_iTXt
 #  endif
 #  if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
-#    define PNG_NO_WRITE_iTXt
+#    define PNG_WRITE_iTXt
 #  endif
 #endif
 
@@ -585,11 +589,13 @@
 #  endif
 #endif
 
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 /* Deprecated, will be removed from version 2.0.0.
    Use PNG_MNG_FEATURES_SUPPORTED instead. */
 #ifndef PNG_NO_READ_EMPTY_PLTE
 #  define PNG_READ_EMPTY_PLTE_SUPPORTED
 #endif
+#endif
 
 #endif /* PNG_READ_SUPPORTED */
 
@@ -633,11 +639,15 @@
 #  endif
 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
 
+#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
+    !defined(PNG_WRITE_INTERLACING_SUPPORTED)
 #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
                                             encoders, but can cause trouble
                                             if left undefined */
+#endif
 
 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
+    !defined(PNG_WRITE_WEIGHTED_FILTER) && \
      defined(PNG_FLOATING_POINT_SUPPORTED)
 #  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
 #endif
@@ -646,10 +656,12 @@
 #  define PNG_WRITE_FLUSH_SUPPORTED
 #endif
 
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
 #ifndef PNG_NO_WRITE_EMPTY_PLTE
 #  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
 #endif
+#endif
 
 #endif /* PNG_WRITE_SUPPORTED */
 
diff --git a/pngerror.c b/pngerror.c
index 6fa4012..bdad7c7 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,9 +1,9 @@
 
 /* pngerror.c - stub functions for i/o and memory allocation
  *
- * libpng version 1.2.8 - December 3, 2004
+ * libpng version 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -16,6 +16,7 @@
 #define PNG_INTERNAL
 #include "png.h"
 
+#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
 static void /* PRIVATE */
 png_default_error PNGARG((png_structp png_ptr,
   png_const_charp error_message));
@@ -293,3 +294,4 @@
    }
 }
 #endif
+#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
diff --git a/pnggccrd.c b/pnggccrd.c
index 248e1b3..db5e571 100644
--- a/pnggccrd.c
+++ b/pnggccrd.c
@@ -6,9 +6,9 @@
  *     and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
  *     for Intel's performance analysis of the MMX vs. non-MMX code.
  *
- * libpng version 1.2.8 - December 3, 2004
+ * libpng version 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * Copyright (c) 1998, Intel Corporation
  *
  * Based on MSVC code contributed by Nirav Chhatrapati, Intel Corp., 1998.
diff --git a/pngget.c b/pngget.c
index 8eefa77..a529ff3 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,9 +1,9 @@
 
 /* pngget.c - retrieval of values from info struct
  *
- * libpng 1.2.8 - December 3, 2004
+ * libpng 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  */
@@ -11,6 +11,8 @@
 #define PNG_INTERNAL
 #include "png.h"
 
+#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
+
 png_uint_32 PNGAPI
 png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
 {
@@ -932,3 +934,4 @@
 #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
 
 #endif /* ?PNG_1_0_X */
+#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
diff --git a/pngmem.c b/pngmem.c
index f1cb693..4ecfed7 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,9 +1,9 @@
 
 /* pngmem.c - stub functions for memory allocation
  *
- * libpng version 1.2.8 - December 3, 2004
+ * libpng version 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -17,6 +17,8 @@
 #define PNG_INTERNAL
 #include "png.h"
 
+#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
+
 /* Borland DOS special memory handler */
 #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
 /* if you change this, be sure to change the one in png.h also */
@@ -593,3 +595,4 @@
    return ((png_voidp)png_ptr->mem_ptr);
 }
 #endif /* PNG_USER_MEM_SUPPORTED */
+#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
diff --git a/pngpread.c b/pngpread.c
index 8c35faa..85ab963 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,9 +1,9 @@
 
 /* pngpread.c - read a png file in push mode
  *
- * libpng version 1.2.8 - December 3, 2004
+ * libpng version 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  */
diff --git a/pngread.c b/pngread.c
index 5924333..df88d1e 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,9 +1,9 @@
 
 /* pngread.c - read a PNG file
  *
- * libpng 1.2.8 - December 3, 2004
+ * libpng 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -14,6 +14,8 @@
 #define PNG_INTERNAL
 #include "png.h"
 
+#if defined(PNG_READ_SUPPORTED)
+
 /* Create a PNG structure for reading, and allocate any memory needed. */
 png_structp PNGAPI
 png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
@@ -169,10 +171,10 @@
    return (png_ptr);
 }
 
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 /* Initialize PNG structure for reading, and allocate any memory needed.
    This interface is deprecated in favour of the png_create_read_struct(),
-   and it will eventually disappear. */
-#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+   and it will disappear as of libpng-1.3.0. */
 #undef png_read_init
 void PNGAPI
 png_read_init(png_structp png_ptr)
@@ -180,7 +182,6 @@
    /* We only come here via pre-1.0.7-compiled applications */
    png_read_init_2(png_ptr, "1.0.6 or earlier", 0, 0);
 }
-#endif
 
 void PNGAPI
 png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
@@ -224,6 +225,7 @@
      }
    png_read_init_3(&png_ptr, user_png_ver, png_struct_size);
 }
+#endif /* PNG_1_0_X || PNG_1_2_X */
 
 void PNGAPI
 png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
@@ -806,7 +808,7 @@
  * not called png_set_interlace_handling(), the display_row buffer will
  * be ignored, so pass NULL to it.
  *
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.8
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.9beta1
  */
 
 void PNGAPI
@@ -856,7 +858,7 @@
  * only call this function once.  If you desire to have an image for
  * each pass of a interlaced image, use png_read_rows() instead.
  *
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.8
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.9beta1
  */
 void PNGAPI
 png_read_image(png_structp png_ptr, png_bytepp image)
@@ -1452,5 +1454,6 @@
       /* quiet compiler warnings */ return;
 
 }
-#endif
+#endif /* PNG_INFO_IMAGE_SUPPORTED */
 #endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#endif /* PNG_READ_SUPPORTED */
diff --git a/pngrio.c b/pngrio.c
index cae501a..1e17505 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,9 +1,9 @@
 
 /* pngrio.c - functions for data input
  *
- * libpng 1.2.8 - December 3, 2004
+ * libpng 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -18,6 +18,8 @@
 #define PNG_INTERNAL
 #include "png.h"
 
+#if defined(PNG_READ_SUPPORTED)
+
 /* Read the data from whatever input you are using.  The default routine
    reads from a file pointer.  Note that this routine sometimes gets called
    with very small lengths, so you should implement some kind of simple
@@ -159,3 +161,4 @@
    png_ptr->output_flush_fn = NULL;
 #endif
 }
+#endif /* PNG_READ_SUPPORTED */
diff --git a/pngrtran.c b/pngrtran.c
index e1d6e3c..c17c0df 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,9 +1,9 @@
 
 /* pngrtran.c - transforms the data in a row for PNG readers
  *
- * libpng version  1.2.8 - December 3, 2004
+ * libpng version  1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -16,6 +16,8 @@
 #define PNG_INTERNAL
 #include "png.h"
 
+#if defined(PNG_READ_SUPPORTED)
+
 /* Set the action on getting a CRC error for an ancillary or critical chunk. */
 void PNGAPI
 png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
@@ -780,7 +782,8 @@
       png_ptr->transformations &= (~PNG_GAMMA);
    }
 
-   if (png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY))
+   if ((png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY)) &&
+        png_ptr->gamma != 0.0)
    {
       png_build_gamma_table(png_ptr);
 #if defined(PNG_READ_BACKGROUND_SUPPORTED)
@@ -3906,210 +3909,208 @@
 png_build_gamma_table(png_structp png_ptr)
 {
   png_debug(1, "in png_build_gamma_table\n");
-  if(png_ptr->gamma != 0.0)
+
+  if (png_ptr->bit_depth <= 8)
   {
-   if (png_ptr->bit_depth <= 8)
-   {
-      int i;
-      double g;
+     int i;
+     double g;
 
-      if (png_ptr->screen_gamma > .000001)
-         g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
-      else
-         g = 1.0;
+     if (png_ptr->screen_gamma > .000001)
+        g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
+     else
+        g = 1.0;
 
-      png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr,
-         (png_uint_32)256);
+     png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr,
+        (png_uint_32)256);
 
-      for (i = 0; i < 256; i++)
-      {
-         png_ptr->gamma_table[i] = (png_byte)(pow((double)i / 255.0,
-            g) * 255.0 + .5);
-      }
+     for (i = 0; i < 256; i++)
+     {
+        png_ptr->gamma_table[i] = (png_byte)(pow((double)i / 255.0,
+           g) * 255.0 + .5);
+     }
 
 #if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
-    defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
-      if (png_ptr->transformations & ((PNG_BACKGROUND) | PNG_RGB_TO_GRAY))
-      {
+   defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+     if (png_ptr->transformations & ((PNG_BACKGROUND) | PNG_RGB_TO_GRAY))
+     {
 
-         g = 1.0 / (png_ptr->gamma);
+        g = 1.0 / (png_ptr->gamma);
 
-         png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr,
-            (png_uint_32)256);
+        png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr,
+           (png_uint_32)256);
 
-         for (i = 0; i < 256; i++)
-         {
-            png_ptr->gamma_to_1[i] = (png_byte)(pow((double)i / 255.0,
-               g) * 255.0 + .5);
-         }
+        for (i = 0; i < 256; i++)
+        {
+           png_ptr->gamma_to_1[i] = (png_byte)(pow((double)i / 255.0,
+              g) * 255.0 + .5);
+        }
 
 
-         png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
-            (png_uint_32)256);
+        png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
+           (png_uint_32)256);
 
-         if(png_ptr->screen_gamma > 0.000001)
-            g = 1.0 / png_ptr->screen_gamma;
-         else
-            g = png_ptr->gamma;   /* probably doing rgb_to_gray */
+        if(png_ptr->screen_gamma > 0.000001)
+           g = 1.0 / png_ptr->screen_gamma;
+        else
+           g = png_ptr->gamma;   /* probably doing rgb_to_gray */
 
-         for (i = 0; i < 256; i++)
-         {
-            png_ptr->gamma_from_1[i] = (png_byte)(pow((double)i / 255.0,
-               g) * 255.0 + .5);
+        for (i = 0; i < 256; i++)
+        {
+           png_ptr->gamma_from_1[i] = (png_byte)(pow((double)i / 255.0,
+              g) * 255.0 + .5);
 
-         }
-      }
+        }
+     }
 #endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */
-   }
-   else
-   {
-      double g;
-      int i, j, shift, num;
-      int sig_bit;
-      png_uint_32 ig;
+  }
+  else
+  {
+     double g;
+     int i, j, shift, num;
+     int sig_bit;
+     png_uint_32 ig;
 
-      if (png_ptr->color_type & PNG_COLOR_MASK_COLOR)
-      {
-         sig_bit = (int)png_ptr->sig_bit.red;
-         if ((int)png_ptr->sig_bit.green > sig_bit)
-            sig_bit = png_ptr->sig_bit.green;
-         if ((int)png_ptr->sig_bit.blue > sig_bit)
-            sig_bit = png_ptr->sig_bit.blue;
-      }
-      else
-      {
-         sig_bit = (int)png_ptr->sig_bit.gray;
-      }
+     if (png_ptr->color_type & PNG_COLOR_MASK_COLOR)
+     {
+        sig_bit = (int)png_ptr->sig_bit.red;
+        if ((int)png_ptr->sig_bit.green > sig_bit)
+           sig_bit = png_ptr->sig_bit.green;
+        if ((int)png_ptr->sig_bit.blue > sig_bit)
+           sig_bit = png_ptr->sig_bit.blue;
+     }
+     else
+     {
+        sig_bit = (int)png_ptr->sig_bit.gray;
+     }
 
-      if (sig_bit > 0)
-         shift = 16 - sig_bit;
-      else
-         shift = 0;
+     if (sig_bit > 0)
+        shift = 16 - sig_bit;
+     else
+        shift = 0;
 
-      if (png_ptr->transformations & PNG_16_TO_8)
-      {
-         if (shift < (16 - PNG_MAX_GAMMA_8))
-            shift = (16 - PNG_MAX_GAMMA_8);
-      }
+     if (png_ptr->transformations & PNG_16_TO_8)
+     {
+        if (shift < (16 - PNG_MAX_GAMMA_8))
+           shift = (16 - PNG_MAX_GAMMA_8);
+     }
 
-      if (shift > 8)
-         shift = 8;
-      if (shift < 0)
-         shift = 0;
+     if (shift > 8)
+        shift = 8;
+     if (shift < 0)
+        shift = 0;
 
-      png_ptr->gamma_shift = (png_byte)shift;
+     png_ptr->gamma_shift = (png_byte)shift;
 
-      num = (1 << (8 - shift));
+     num = (1 << (8 - shift));
 
-      if (png_ptr->screen_gamma > .000001)
-         g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
-      else
-         g = 1.0;
+     if (png_ptr->screen_gamma > .000001)
+        g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
+     else
+        g = 1.0;
 
-      png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
-         (png_uint_32)(num * png_sizeof (png_uint_16p)));
+     png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
+        (png_uint_32)(num * png_sizeof (png_uint_16p)));
 
-      if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
-      {
-         double fin, fout;
-         png_uint_32 last, max;
+     if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
+     {
+        double fin, fout;
+        png_uint_32 last, max;
 
-         for (i = 0; i < num; i++)
-         {
-            png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
-               (png_uint_32)(256 * png_sizeof (png_uint_16)));
-         }
+        for (i = 0; i < num; i++)
+        {
+           png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
+              (png_uint_32)(256 * png_sizeof (png_uint_16)));
+        }
 
-         g = 1.0 / g;
-         last = 0;
-         for (i = 0; i < 256; i++)
-         {
-            fout = ((double)i + 0.5) / 256.0;
-            fin = pow(fout, g);
-            max = (png_uint_32)(fin * (double)((png_uint_32)num << 8));
-            while (last <= max)
-            {
-               png_ptr->gamma_16_table[(int)(last & (0xff >> shift))]
-                  [(int)(last >> (8 - shift))] = (png_uint_16)(
-                  (png_uint_16)i | ((png_uint_16)i << 8));
-               last++;
-            }
-         }
-         while (last < ((png_uint_32)num << 8))
-         {
-            png_ptr->gamma_16_table[(int)(last & (0xff >> shift))]
-               [(int)(last >> (8 - shift))] = (png_uint_16)65535L;
-            last++;
-         }
-      }
-      else
-      {
-         for (i = 0; i < num; i++)
-         {
-            png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
-               (png_uint_32)(256 * png_sizeof (png_uint_16)));
+        g = 1.0 / g;
+        last = 0;
+        for (i = 0; i < 256; i++)
+        {
+           fout = ((double)i + 0.5) / 256.0;
+           fin = pow(fout, g);
+           max = (png_uint_32)(fin * (double)((png_uint_32)num << 8));
+           while (last <= max)
+           {
+              png_ptr->gamma_16_table[(int)(last & (0xff >> shift))]
+                 [(int)(last >> (8 - shift))] = (png_uint_16)(
+                 (png_uint_16)i | ((png_uint_16)i << 8));
+              last++;
+           }
+        }
+        while (last < ((png_uint_32)num << 8))
+        {
+           png_ptr->gamma_16_table[(int)(last & (0xff >> shift))]
+              [(int)(last >> (8 - shift))] = (png_uint_16)65535L;
+           last++;
+        }
+     }
+     else
+     {
+        for (i = 0; i < num; i++)
+        {
+           png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
+              (png_uint_32)(256 * png_sizeof (png_uint_16)));
 
-            ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4);
-            for (j = 0; j < 256; j++)
-            {
-               png_ptr->gamma_16_table[i][j] =
-                  (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) /
-                     65535.0, g) * 65535.0 + .5);
-            }
-         }
-      }
+           ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4);
+           for (j = 0; j < 256; j++)
+           {
+              png_ptr->gamma_16_table[i][j] =
+                 (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) /
+                    65535.0, g) * 65535.0 + .5);
+           }
+        }
+     }
 
 #if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
-    defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
-      if (png_ptr->transformations & (PNG_BACKGROUND | PNG_RGB_TO_GRAY))
-      {
+   defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+     if (png_ptr->transformations & (PNG_BACKGROUND | PNG_RGB_TO_GRAY))
+     {
 
-         g = 1.0 / (png_ptr->gamma);
+        g = 1.0 / (png_ptr->gamma);
 
-         png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
-            (png_uint_32)(num * png_sizeof (png_uint_16p )));
+        png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
+           (png_uint_32)(num * png_sizeof (png_uint_16p )));
 
-         for (i = 0; i < num; i++)
-         {
-            png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr,
-               (png_uint_32)(256 * png_sizeof (png_uint_16)));
+        for (i = 0; i < num; i++)
+        {
+           png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr,
+              (png_uint_32)(256 * png_sizeof (png_uint_16)));
 
-            ig = (((png_uint_32)i *
-               (png_uint_32)png_gamma_shift[shift]) >> 4);
-            for (j = 0; j < 256; j++)
-            {
-               png_ptr->gamma_16_to_1[i][j] =
-                  (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) /
-                     65535.0, g) * 65535.0 + .5);
-            }
-         }
+           ig = (((png_uint_32)i *
+              (png_uint_32)png_gamma_shift[shift]) >> 4);
+           for (j = 0; j < 256; j++)
+           {
+              png_ptr->gamma_16_to_1[i][j] =
+                 (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) /
+                    65535.0, g) * 65535.0 + .5);
+           }
+        }
 
-         if(png_ptr->screen_gamma > 0.000001)
-            g = 1.0 / png_ptr->screen_gamma;
-         else
-            g = png_ptr->gamma;   /* probably doing rgb_to_gray */
+        if(png_ptr->screen_gamma > 0.000001)
+           g = 1.0 / png_ptr->screen_gamma;
+        else
+           g = png_ptr->gamma;   /* probably doing rgb_to_gray */
 
-         png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
-            (png_uint_32)(num * png_sizeof (png_uint_16p)));
+        png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
+           (png_uint_32)(num * png_sizeof (png_uint_16p)));
 
-         for (i = 0; i < num; i++)
-         {
-            png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr,
-               (png_uint_32)(256 * png_sizeof (png_uint_16)));
+        for (i = 0; i < num; i++)
+        {
+           png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr,
+              (png_uint_32)(256 * png_sizeof (png_uint_16)));
 
-            ig = (((png_uint_32)i *
-               (png_uint_32)png_gamma_shift[shift]) >> 4);
-            for (j = 0; j < 256; j++)
-            {
-               png_ptr->gamma_16_from_1[i][j] =
-                  (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) /
-                     65535.0, g) * 65535.0 + .5);
-            }
-         }
-      }
+           ig = (((png_uint_32)i *
+              (png_uint_32)png_gamma_shift[shift]) >> 4);
+           for (j = 0; j < 256; j++)
+           {
+              png_ptr->gamma_16_from_1[i][j] =
+                 (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) /
+                    65535.0, g) * 65535.0 + .5);
+           }
+        }
+     }
 #endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */
-   }
- }
+  }
 }
 #endif
 /* To do: install integer version of png_build_gamma_table here */
@@ -4175,3 +4176,4 @@
    }
 }
 #endif /* PNG_MNG_FEATURES_SUPPORTED */
+#endif /* PNG_READ_SUPPORTED */
diff --git a/pngrutil.c b/pngrutil.c
index 99e466f..9c434e0 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,8 +1,8 @@
 /* pngrutil.c - utilities to read a PNG file
  *
- * libpng version 1.2.8 - December 3, 2004
+ * libpng version 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -13,6 +13,8 @@
 #define PNG_INTERNAL
 #include "png.h"
 
+#if defined(PNG_READ_SUPPORTED)
+
 #if defined(_WIN32_WCE)
 /* strtod() function is not supported on WindowsCE */
 #  ifdef PNG_FLOATING_POINT_SUPPORTED
@@ -37,7 +39,7 @@
 #  endif
 #endif
 
-png_uint_32 /* PRIVATE */
+png_uint_32 PNGAPI
 png_get_uint_31(png_structp png_ptr, png_bytep buf)
 {
    png_uint_32 i = png_get_uint_32(buf);
@@ -47,7 +49,7 @@
 }
 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
 /* Grab an unsigned 32-bit integer from a buffer in big-endian format. */
-png_uint_32 /* PRIVATE */
+png_uint_32 PNGAPI
 png_get_uint_32(png_bytep buf)
 {
    png_uint_32 i = ((png_uint_32)(*buf) << 24) +
@@ -62,7 +64,7 @@
 /* Grab a signed 32-bit integer from a buffer in big-endian format.  The
  * data is stored in the PNG file in two's complement format, and it is
  * assumed that the machine format for signed integers is the same. */
-png_int_32 /* PRIVATE */
+png_int_32 PNGAPI
 png_get_int_32(png_bytep buf)
 {
    png_int_32 i = ((png_int_32)(*buf) << 24) +
@@ -75,7 +77,7 @@
 #endif /* PNG_READ_pCAL_SUPPORTED */
 
 /* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
-png_uint_16 /* PRIVATE */
+png_uint_16 PNGAPI
 png_get_uint_16(png_bytep buf)
 {
    png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) +
@@ -1160,7 +1162,7 @@
       return;
    }
 
-   new_palette.nentries = (png_uint_32) (data_length / entry_size);
+   new_palette.nentries = (png_int_32) ( data_length / entry_size);
    if ((png_uint_32) new_palette.nentries > (png_uint_32) (PNG_SIZE_MAX /
        png_sizeof(png_sPLT_entry)))
    {
@@ -2170,7 +2172,8 @@
    }
 
 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
-   if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
+   if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) ||
+       (png_ptr->read_user_chunk_fn != NULL))
    {
        png_unknown_chunk chunk;
 
@@ -3122,3 +3125,4 @@
 
    png_ptr->flags |= PNG_FLAG_ROW_INIT;
 }
+#endif /* PNG_READ_SUPPORTED */
diff --git a/pngset.c b/pngset.c
index 5922cad..9d688a0 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,9 +1,9 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * libpng 1.2.8 - December 3, 2004
+ * libpng 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -16,6 +16,8 @@
 #define PNG_INTERNAL
 #include "png.h"
 
+#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
+
 #if defined(PNG_bKGD_SUPPORTED)
 void PNGAPI
 png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
@@ -100,6 +102,7 @@
         "Ignoring attempt to set negative chromaticity value");
       return;
    }
+#ifdef PNG_FLOATING_POINT_SUPPORTED
    if (white_x > (double) PNG_UINT_31_MAX ||
        white_y > (double) PNG_UINT_31_MAX ||
          red_x > (double) PNG_UINT_31_MAX ||
@@ -108,6 +111,16 @@
        green_y > (double) PNG_UINT_31_MAX ||
         blue_x > (double) PNG_UINT_31_MAX ||
         blue_y > (double) PNG_UINT_31_MAX)
+#else
+   if (white_x > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
+       white_y > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
+         red_x > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
+         red_y > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
+       green_x > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
+       green_y > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
+        blue_x > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
+        blue_y > (png_fixed_point) PNG_UINT_31_MAX/100000L)
+#endif
    {
       png_warning(png_ptr,
         "Ignoring attempt to set chromaticity value exceeding 21474.83");
@@ -209,19 +222,21 @@
    png_debug1(1, "in %s storage function\n", "hIST");
    if (png_ptr == NULL || info_ptr == NULL)
       return;
-   if (info_ptr->num_palette == 0)
+   if (info_ptr->num_palette <= 0 || info_ptr->num_palette
+       > PNG_MAX_PALETTE_LENGTH)
    {
        png_warning(png_ptr,
-          "Palette size 0, hIST allocation skipped.");
+          "Invalid palette size, hIST allocation skipped.");
        return;
    }
 
 #ifdef PNG_FREE_ME_SUPPORTED
    png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
 #endif
-   /* Changed from info->num_palette to 256 in version 1.2.1 */
+   /* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in version
+      1.2.1 */
    png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr,
-      (png_uint_32)(256 * png_sizeof (png_uint_16)));
+      (png_uint_32)(PNG_MAX_PALETTE_LENGTH * png_sizeof (png_uint_16)));
    if (png_ptr->hist == NULL)
      {
        png_warning(png_ptr, "Insufficient memory for hIST chunk data.");
@@ -517,6 +532,17 @@
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
+   if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH)
+     {
+       if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+         png_error(png_ptr, "Invalid palette length");
+       else
+       {
+         png_warning(png_ptr, "Invalid palette length");
+         return;
+       }
+     }
+
    /*
     * It may not actually be necessary to set png_ptr->palette here;
     * we do it for backward compatibility with the way the png_handle_tRNS
@@ -526,11 +552,13 @@
    png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
 #endif
 
-   /* Changed in libpng-1.2.1 to allocate 256 instead of num_palette entries,
+   /* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
+      of num_palette entries,
       in case of an invalid PNG file that has too-large sample values. */
    png_ptr->palette = (png_colorp)png_malloc(png_ptr,
-      256 * png_sizeof(png_color));
-   png_memset(png_ptr->palette, 0, 256 * png_sizeof(png_color));
+      PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
+   png_memset(png_ptr->palette, 0, PNG_MAX_PALETTE_LENGTH *
+      png_sizeof(png_color));
    png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof (png_color));
    info_ptr->palette = png_ptr->palette;
    info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
@@ -890,10 +918,11 @@
 #ifdef PNG_FREE_ME_SUPPORTED
        png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
 #endif
-       /* Changed from num_trans to 256 in version 1.2.1 */
+       /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
        png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr,
-           (png_uint_32)256);
-       png_memcpy(info_ptr->trans, trans, (png_size_t)num_trans);
+           (png_uint_32)PNG_MAX_PALETTE_LENGTH);
+       if (num_trans <= PNG_MAX_PALETTE_LENGTH)
+         png_memcpy(info_ptr->trans, trans, (png_size_t)num_trans);
 #ifdef PNG_FREE_ME_SUPPORTED
        info_ptr->free_me |= PNG_FREE_TRNS;
 #else
@@ -1217,3 +1246,4 @@
 #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
 
 #endif /* ?PNG_1_0_X */
+#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
diff --git a/pngtest.c b/pngtest.c
index f2085e1..5b5f1d1 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,9 +1,9 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * libpng 1.2.8 - December 3, 2004
+ * libpng 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -1551,4 +1551,4 @@
 }
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_8 your_png_h_is_not_version_1_2_8;
+typedef version_1_2_9beta1 your_png_h_is_not_version_1_2_9beta1;
diff --git a/pngtrans.c b/pngtrans.c
index 9003a21..fcb13cc 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -1,9 +1,9 @@
 
 /* pngtrans.c - transforms the data in a row (used by both readers and writers)
  *
- * libpng  1.2.8 - December 3, 2004
+ * libpng  1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  */
@@ -11,6 +11,7 @@
 #define PNG_INTERNAL
 #include "png.h"
 
+#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
 /* turn on BGR-to-RGB mapping */
 void PNGAPI
@@ -648,3 +649,4 @@
    return (NULL);
 #endif
 }
+#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
diff --git a/pngvcrd.c b/pngvcrd.c
index 940a7fc..c8e0b81 100644
--- a/pngvcrd.c
+++ b/pngvcrd.c
@@ -2,9 +2,9 @@
  *
  * For Intel x86 CPU and Microsoft Visual C++ compiler
  *
- * libpng version 1.2.8 - December 3, 2004
+ * libpng version 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * Copyright (c) 1998, Intel Corporation
  *
  * Contributed by Nirav Chhatrapati, Intel Corporation, 1998
diff --git a/pngwio.c b/pngwio.c
index d5d61f4..152b814 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,9 +1,9 @@
 
 /* pngwio.c - functions for data output
  *
- * libpng 1.2.8 - December 3, 2004
+ * libpng 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
diff --git a/pngwrite.c b/pngwrite.c
index 3246fda..11e4e3e 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,9 +1,9 @@
 
 /* pngwrite.c - general routines to write a PNG file
  *
- * libpng 1.2.8 - December 3, 2004
+ * libpng 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  */
@@ -554,6 +554,8 @@
 }
 
 /* Initialize png_ptr structure, and allocate any memory needed */
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+/* Deprecated. */
 #undef png_write_init
 void PNGAPI
 png_write_init(png_structp png_ptr)
@@ -604,6 +606,7 @@
      }
    png_write_init_3(&png_ptr, user_png_ver, png_struct_size);
 }
+#endif /* PNG_1_0_X || PNG_1_2_X */
 
 
 void PNGAPI
diff --git a/pngwtran.c b/pngwtran.c
index f1c8b3e..5141f7b 100644
--- a/pngwtran.c
+++ b/pngwtran.c
@@ -1,9 +1,9 @@
 
 /* pngwtran.c - transforms the data in a row for PNG writers
  *
- * libpng version 1.2.8 - December 3, 2004
+ * libpng version 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  */
@@ -60,14 +60,14 @@
       png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
          &(png_ptr->shift));
 #endif
-#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
-   if (png_ptr->transformations & PNG_INVERT_ALPHA)
-      png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
-#endif
 #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
    if (png_ptr->transformations & PNG_SWAP_ALPHA)
       png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
 #endif
+#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
+   if (png_ptr->transformations & PNG_INVERT_ALPHA)
+      png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
+#endif
 #if defined(PNG_WRITE_BGR_SUPPORTED)
    if (png_ptr->transformations & PNG_BGR)
       png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
@@ -439,9 +439,12 @@
             png_uint_32 row_width = row_info->width;
             for (i = 0, sp = dp = row; i < row_width; i++)
             {
+               /* does nothing
                *(dp++) = *(sp++);
                *(dp++) = *(sp++);
                *(dp++) = *(sp++);
+               */
+               sp+=3; dp = sp;
                *(dp++) = (png_byte)(255 - *(sp++));
             }
          }
@@ -454,12 +457,15 @@
 
             for (i = 0, sp = dp = row; i < row_width; i++)
             {
+               /* does nothing
                *(dp++) = *(sp++);
                *(dp++) = *(sp++);
                *(dp++) = *(sp++);
                *(dp++) = *(sp++);
                *(dp++) = *(sp++);
                *(dp++) = *(sp++);
+               */
+               sp+=6; dp = sp;
                *(dp++) = (png_byte)(255 - *(sp++));
                *(dp++) = (png_byte)(255 - *(sp++));
             }
@@ -489,8 +495,11 @@
 
             for (i = 0, sp = dp = row; i < row_width; i++)
             {
+               /* does nothing
                *(dp++) = *(sp++);
                *(dp++) = *(sp++);
+               */
+               sp+=2; dp = sp;
                *(dp++) = (png_byte)(255 - *(sp++));
                *(dp++) = (png_byte)(255 - *(sp++));
             }
diff --git a/pngwutil.c b/pngwutil.c
index dd7b150..a1ccde3 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,9 +1,9 @@
 
 /* pngwutil.c - utilities to write a PNG file
  *
- * libpng version 1.2.8 - December 3, 2004
+ * libpng version 1.2.9beta1 - February 21, 2006
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2006 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  */
@@ -16,7 +16,7 @@
  * with unsigned numbers for convenience, although one supported
  * ancillary chunk uses signed (two's complement) numbers.
  */
-void /* PRIVATE */
+void PNGAPI
 png_save_uint_32(png_bytep buf, png_uint_32 i)
 {
    buf[0] = (png_byte)((i >> 24) & 0xff);
@@ -30,7 +30,7 @@
  * complement format.  If this isn't the case, then this routine needs to
  * be modified to write data in two's complement format.
  */
-void /* PRIVATE */
+void PNGAPI
 png_save_int_32(png_bytep buf, png_int_32 i)
 {
    buf[0] = (png_byte)((i >> 24) & 0xff);
@@ -44,7 +44,7 @@
  * The parameter is declared unsigned int, not png_uint_16,
  * just to avoid potential problems on pre-ANSI C compilers.
  */
-void /* PRIVATE */
+void PNGAPI
 png_save_uint_16(png_bytep buf, unsigned int i)
 {
    buf[0] = (png_byte)((i >> 8) & 0xff);
@@ -161,9 +161,11 @@
 {
    int ret;
 
-   comp->num_output_ptr = comp->max_output_ptr = 0;
+   comp->num_output_ptr = 0;
+   comp->max_output_ptr = 0;
    comp->output_ptr = NULL;
    comp->input = NULL;
+   comp->input_len = 0;
 
    /* we may just want to pass the text right through */
    if (compression == PNG_TEXT_COMPRESSION_NONE)
@@ -730,6 +732,13 @@
    compression_state comp;
 
    png_debug(1, "in png_write_iCCP\n");
+
+   comp.num_output_ptr = 0;
+   comp.max_output_ptr = 0;
+   comp.output_ptr = NULL;
+   comp.input = NULL;
+   comp.input_len = 0;
+
    if (name == NULL || (name_len = png_check_keyword(png_ptr, name,
       &new_name)) == 0)
    {
@@ -1344,6 +1353,12 @@
 
    png_debug(1, "in png_write_zTXt\n");
 
+   comp.num_output_ptr = 0;
+   comp.max_output_ptr = 0;
+   comp.output_ptr = NULL;
+   comp.input = NULL;
+   comp.input_len = 0;
+
    if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0)
    {
       png_warning(png_ptr, "Empty keyword in zTXt chunk");
@@ -1397,6 +1412,11 @@
 
    png_debug(1, "in png_write_iTXt\n");
 
+   comp.num_output_ptr = 0;
+   comp.max_output_ptr = 0;
+   comp.output_ptr = NULL;
+   comp.input = NULL;
+
    if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0)
    {
       png_warning(png_ptr, "Empty keyword in iTXt chunk");
@@ -1559,7 +1579,7 @@
 #endif
    png_size_t total_len;
    char wbuf[32], hbuf[32];
-   png_byte bunit = unit;
+   png_byte bunit = (png_byte)unit;
 
    png_debug(1, "in png_write_sCAL\n");
 
diff --git a/scripts/libpng-config-head.in b/scripts/libpng-config-head.in
index b2c6a33..ff3d9b9 100755
--- a/scripts/libpng-config-head.in
+++ b/scripts/libpng-config-head.in
@@ -8,7 +8,7 @@
 
 # Modeled after libxml-config.
 
-version=1.2.8
+version=1.2.9beta1
 prefix=""
 libdir=""
 libs=""
diff --git a/scripts/libpng.pc.in b/scripts/libpng.pc.in
index f164c41..54cc7e2 100644
--- a/scripts/libpng.pc.in
+++ b/scripts/libpng.pc.in
@@ -6,6 +6,6 @@
 
 Name: libpng12
 Description: Loads and saves PNG files
-Version: 1.2.8
+Version: 1.2.9beta1
 Libs: -L${libdir} -lpng12 -lz -lm
 Cflags: -I${includedir}/libpng12
diff --git a/scripts/makefile.32sunu b/scripts/makefile.32sunu
index a70c1a1..7b0506e 100644
--- a/scripts/makefile.32sunu
+++ b/scripts/makefile.32sunu
@@ -33,7 +33,7 @@
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
@@ -111,9 +111,9 @@
 	$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
 	 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
 
-libpng.so.3.$(PNGMIN): $(OBJS)
-	$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.3 \
-	 -o libpng.so.3.$(PNGMIN)  $(OBJSDLL)
+libpng.so.0.$(PNGMIN): $(OBJS)
+	$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.0 \
+	 -o libpng.so.0.$(PNGMIN)  $(OBJSDLL)
 
 pngtest: pngtest.o $(LIBNAME).so
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
@@ -138,20 +138,20 @@
 	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGVER)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGVER)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -f -s libpng.so.3 libpng.so; \
+	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -f -s libpng.so.0 libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -207,7 +207,7 @@
 clean:
 	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	libpng.pc
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
diff --git a/scripts/makefile.64sunu b/scripts/makefile.64sunu
index 4b3360a..91de916 100644
--- a/scripts/makefile.64sunu
+++ b/scripts/makefile.64sunu
@@ -33,7 +33,7 @@
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
@@ -111,9 +111,9 @@
 	$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
 	 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
 
-libpng.so.3.$(PNGMIN): $(OBJSDLL)
-	$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.3 \
-	 -o libpng.so.3.$(PNGMIN)  $(OBJSDLL)
+libpng.so.0.$(PNGMIN): $(OBJSDLL)
+	$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.0 \
+	 -o libpng.so.0.$(PNGMIN)  $(OBJSDLL)
 
 pngtest: pngtest.o $(LIBNAME).so
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
@@ -138,21 +138,21 @@
 	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ).$(PNGVER)*
 	-@/bin/rm -f $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGVER)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGVER)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -f -s libpng.so.3 libpng.so; \
+	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -f -s libpng.so.0 libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -208,7 +208,7 @@
 clean:
 	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	libpng.pc
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
diff --git a/scripts/makefile.aix b/scripts/makefile.aix
index 93aec12..161dbac 100644
--- a/scripts/makefile.aix
+++ b/scripts/makefile.aix
@@ -18,7 +18,7 @@
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 prefix=/usr/local
diff --git a/scripts/makefile.bc32 b/scripts/makefile.bc32
index 90b178b..04407dd 100644
--- a/scripts/makefile.bc32
+++ b/scripts/makefile.bc32
@@ -17,14 +17,14 @@
 LD=bcc32
 LIB=tlib
 
-#TARGET_CPU=6
-# 3 = 386, 4 = 486, 5 = Pentium etc.
+# -3 = 386, -4 = 486, -5 = Pentium etc.
 !ifndef TARGET_CPU
-TARGET_CPU=5
+#TARGET_CPU=-6
 !endif
 
 # Use this if you don't want Borland's fancy exception handling
-NOEHLIB=noeh32.lib
+# (Caution: doesn't work with CBuilderX)
+#NOEHLIB=noeh32.lib
 
 !ifdef DEBUG
 CDEBUG=-v
@@ -40,14 +40,14 @@
 LDEBUG=$(LDEBUG) -N
 !endif
 
-# -X- turn on dependency generation in the object file
-# -w  set all warnings on
 # -O2 optimize for speed
-# -Z  global optimization
-CFLAGS=-O2 -Z -X- -w -I$(ZLIB_DIR) -$(TARGET_CPU) $(CDEBUG)
+# -d  merge duplicate strings
+# -k- turn off standard stack frame
+# -w  display all warnings
+CFLAGS=-I$(ZLIB_DIR) -O2 -d -k- -w $(TARGET_CPU) $(CDEBUG)
 
 # -M  generate map file
-LDFLAGS=-M -L$(ZLIB_DIR) $(LDEBUG)
+LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG)
 
 
 ## Variables
@@ -138,14 +138,15 @@
 |
 
 
-# Clean up anything else you want
+# Cleanup
 clean:
 	-del *.obj
-	-del *.exe
-	-del *.lib
+	-del $(LIBNAME)
+	-del pngtest.exe
 	-del *.lst
 	-del *.map
 	-del *.tds
+	-del pngout.png
 
 
 # End of makefile for libpng
diff --git a/scripts/makefile.beos b/scripts/makefile.beos
index 98ace87..50bc54b 100644
--- a/scripts/makefile.beos
+++ b/scripts/makefile.beos
@@ -12,7 +12,7 @@
 ZLIBINC=/usr/local/include
 
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 ALIGN=
@@ -93,9 +93,9 @@
 	$(CC) -nostart -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o \
 	$(LIBNAME).so.$(PNGVER) $(OBJSDLL)
 
-libpng.so.3.$(PNGMIN): $(OBJSDLL)
-	$(CC) -nostart -Wl,-soname,libpng.so.3 -o \
-	libpng.so.3.$(PNGMIN) $(OBJSDLL)
+libpng.so.0.$(PNGMIN): $(OBJSDLL)
+	$(CC) -nostart -Wl,-soname,libpng.so.0 -o \
+	libpng.so.0.$(PNGMIN) $(OBJSDLL)
 
 pngtest: pngtest.o $(LIBNAME).so
 	$(CC) -L$(ZLIBLIB) -lz -lpng12 -o pngtest pngtest.o
@@ -120,20 +120,20 @@
 	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -sf libpng.so.3 libpng.so; \
+	ln -sf libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -sf libpng.so.0 libpng.so; \
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -187,7 +187,7 @@
 clean:
 	/bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtesti \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	libpng.pc
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/scripts/makefile.cygwin b/scripts/makefile.cygwin
index 09f92d3..226204a 100644
--- a/scripts/makefile.cygwin
+++ b/scripts/makefile.cygwin
@@ -79,7 +79,7 @@
 LIBNAME = libpng12
 PNGMAJ = 0
 CYGDLL = 12
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 SHAREDLIB=cygpng$(CYGDLL).dll
@@ -176,7 +176,7 @@
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
-$(SHAREDDEF): scripts/png32ms.def
+$(SHAREDDEF): scripts/pngw32.def
 	cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \
 	sed -e 's/\([^;]*\);/;/' > $@
 
diff --git a/scripts/makefile.darwin b/scripts/makefile.darwin
index 1a1f988..5d54389 100644
--- a/scripts/makefile.darwin
+++ b/scripts/makefile.darwin
@@ -23,7 +23,7 @@
 RANLIB=ranlib
 
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
diff --git a/scripts/makefile.dec b/scripts/makefile.dec
index f8482f9..1a757fe 100644
--- a/scripts/makefile.dec
+++ b/scripts/makefile.dec
@@ -32,7 +32,7 @@
 ZLIBINC=../zlib
 
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
@@ -76,9 +76,9 @@
 	$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
 	-soname $(LIBNAME).so.$(PNGMAJ)
 
-libpng.so.3.$(PNGMIN): $(OBJS)
+libpng.so.0.$(PNGMIN): $(OBJS)
 	$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
-	-soname libpng.so.3
+	-soname libpng.so.0
 
 pngtest: pngtest.o libpng.a
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
@@ -103,20 +103,20 @@
 	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -f -s libpng.so.3 libpng.so; \
+	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -f -s libpng.so.0 libpng.so; \
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -172,7 +172,7 @@
 clean:
 	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	libpng.pc
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/scripts/makefile.elf b/scripts/makefile.elf
deleted file mode 100644
index a04b497..0000000
--- a/scripts/makefile.elf
+++ /dev/null
@@ -1,249 +0,0 @@
-# makefile for libpng.a and libpng12.so on Linux ELF with gcc
-# Copyright (C) 1998, 1999, 2002 Greg Roelofs and Glenn Randers-Pehrson
-# Copyright (C) 1996, 1997 Andreas Dilger
-# For conditions of distribution and use, see copyright notice in png.h
-
-LIBNAME = libpng12
-PNGMAJ = 0
-PNGMIN = 1.2.8
-PNGVER = $(PNGMAJ).$(PNGMIN)
-
-CC=gcc
-
-# where "make install" puts libpng12.a, libpng12.so*,
-# libpng12/png.h and libpng12/pngconf.h
-# Prefix must be a full pathname.
-prefix=/usr/local
-
-# Where the zlib library and include files are located.
-#ZLIBLIB=/usr/local/lib
-#ZLIBINC=/usr/local/include
-ZLIBLIB=../zlib
-ZLIBINC=../zlib
-
-ALIGN=
-# for i386:
-#ALIGN=-malign-loops=2 -malign-functions=2
-
-WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-	-Wmissing-declarations -Wtraditional -Wcast-align \
-	-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
-
-# for pgcc version 2.95.1, -O3 is buggy; don't use it.
-
-CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
-	$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
-
-LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
-LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
-
-RANLIB=ranlib
-#RANLIB=echo
-
-INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
-MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
-
-# override DESTDIR= on the make install command line to easily support
-# installing into a temporary location.  Example:
-#
-#    make install DESTDIR=/tmp/build/libpng
-#
-# If you're going to install into a temporary location
-# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
-# you execute make install.
-DESTDIR=
-
-DB=$(DESTDIR)$(BINPATH)
-DI=$(DESTDIR)$(INCPATH)
-DL=$(DESTDIR)$(LIBPATH)
-DM=$(DESTDIR)$(MANPATH)
-
-OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
-	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
-	pngwtran.o pngmem.o pngerror.o pngpread.o
-
-OBJSDLL = $(OBJS:.o=.pic.o)
-
-.SUFFIXES:      .c .o .pic.o
-
-.c.pic.o:
-	$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
-
-all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
-
-libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
-	$(RANLIB) $@
-
-libpng.pc:
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-
-libpng.syms: png.h pngconf.h
-	$(CC) $(CFLAGS) -E -DPNG_BUILDSYMS png.h |\
-	awk -F '[\t [\]();]' 'BEGIN{print "{global:"}\
-	{ for (i=1;i+2<=NF;++i)\
-		if ($$(i)=="PNG_FUNCTION_EXPORT" && $$(i+2)=="END")\
-			print $$(i+1) ";";\
-	for (i=1;i+1<=NF;++i)\
-		if ($$(i)=="PNG_DATA_EXPORT")\
-			print $$(i+1) ";";}\
-	END{print "local: *; };"}' >$@.new
-	rm -f $@
-	mv $@.new $@
-
-libpng-config:
-	( cat scripts/libpng-config-head.in; \
-	echo prefix=\"$(prefix)\"; \
-	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
-	echo L_opts=\"-L$(LIBPATH)\"; \
-	echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
-	echo libs=\"-lpng12 -lz -lm\"; \
-	cat scripts/libpng-config-body.in ) > libpng-config
-	chmod +x libpng-config
-
-$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
-
-$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
-
-$(LIBNAME).so.$(PNGVER): $(OBJSDLL) libpng.syms
-	$(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) \
-	-Wl,-version-script,libpng.syms \
-	-o $(LIBNAME).so.$(PNGVER) \
-	$(OBJSDLL)
-
-libpng.so.3.$(PNGMIN): $(OBJSDLL) libpng.syms
-	$(CC) -shared -Wl,-soname,libpng.so.3 \
-	-Wl,-version-script,libpng.syms \
-	-o libpng.so.3.$(PNGMIN) \
-	$(OBJSDLL)
-
-pngtest: pngtest.o $(LIBNAME).so
-	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
-
-pngtest-static: pngtest.o libpng.a
-	$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
-
-test: pngtest pngtest-static
-	@echo ""
-	@echo "   Running pngtest dynamically linked with $(LIBNAME).so:"
-	@echo ""
-	./pngtest
-	@echo ""
-	@echo "   Running pngtest statically linked with libpng.a:"
-	@echo ""
-	./pngtest-static
-
-install-headers: png.h pngconf.h
-	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
-	cp png.h pngconf.h $(DI)/$(LIBNAME)
-	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
-
-install-static: install-headers libpng.a
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	cp libpng.a $(DL)/$(LIBNAME).a
-	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
-
-install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
-	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
-	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
-	(cd $(DL); \
-	ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -sf libpng.so.3 libpng.so; \
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
-	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
-	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
-
-install-man: libpng.3 libpngpf.3 png.5
-	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
-	cp libpng.3 $(DM)/man3
-	cp libpngpf.3 $(DM)/man3
-	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
-	cp png.5 $(DM)/man5
-
-install-config: libpng-config
-	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
-	cp libpng-config $(DB)/$(LIBNAME)-config
-	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
-
-install: install-static install-shared install-man install-config
-
-# If you installed in $(DESTDIR), test-installed won't work until you
-# move the library to its final location.  Use test-dd to test it
-# before then.
-
-test-dd:
-	echo
-	echo Testing installed dynamic shared library in $(DL).
-	$(CC) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-	   -L$(DL) -L$(ZLIBLIB) -W1, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
-	./pngtestd pngtest.png
-
-test-installed:
-	$(CC) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
-	./pngtesti pngtest.png
-
-clean:
-	/bin/rm -f *.o libpng.a libpng.syms pngtest pngout.png libpng-config \
-	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti \
-	libpng.so.3.$(PNGMIN) \
-	libpng.pc
-
-DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
-writelock:
-	chmod a-w *.[ch35] $(DOCS) scripts/*
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-png.o png.pic.o: png.h pngconf.h
-pngerror.o pngerror.pic.o: png.h pngconf.h
-pngrio.o pngrio.pic.o: png.h pngconf.h
-pngwio.o pngwio.pic.o: png.h pngconf.h
-pngmem.o pngmem.pic.o: png.h pngconf.h
-pngset.o pngset.pic.o: png.h pngconf.h
-pngget.o pngget.pic.o: png.h pngconf.h
-pngread.o pngread.pic.o: png.h pngconf.h
-pngrtran.o pngrtran.pic.o: png.h pngconf.h
-pngrutil.o pngrutil.pic.o: png.h pngconf.h
-pngtrans.o pngtrans.pic.o: png.h pngconf.h
-pngwrite.o pngwrite.pic.o: png.h pngconf.h
-pngwtran.o pngwtran.pic.o: png.h pngconf.h
-pngwutil.o pngwutil.pic.o: png.h pngconf.h
-pngpread.o pngpread.pic.o: png.h pngconf.h
-
-pngtest.o: png.h pngconf.h
diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx
index c46c221..5c4ae57 100644
--- a/scripts/makefile.gcmmx
+++ b/scripts/makefile.gcmmx
@@ -15,7 +15,7 @@
 
 LIBNAME = libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CC=gcc
@@ -129,9 +129,9 @@
 	-o $(LIBNAME).so.$(PNGVER) \
 	$(OBJSDLL)
 
-libpng.so.3.$(PNGMIN): $(OBJSDLL)
-	$(CC) -shared -Wl,-soname,libpng.so.3 \
-	-o libpng.so.3.$(PNGMIN) \
+libpng.so.0.$(PNGMIN): $(OBJSDLL)
+	$(CC) -shared -Wl,-soname,libpng.so.0 \
+	-o libpng.so.0.$(PNGMIN) \
 	$(OBJSDLL)
 
 pngtest: pngtest.o $(LIBNAME).so
@@ -167,20 +167,20 @@
 	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -sf libpng.so.3 libpng.so; \
+	ln -sf libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -sf libpng.so.0 libpng.so; \
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -234,7 +234,7 @@
 clean:
 	/bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	libpng.pc
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
diff --git a/scripts/makefile.hp64 b/scripts/makefile.hp64
index e860e37..f6e4557 100644
--- a/scripts/makefile.hp64
+++ b/scripts/makefile.hp64
@@ -27,7 +27,7 @@
 RANLIB=ranlib
 
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
diff --git a/scripts/makefile.hpgcc b/scripts/makefile.hpgcc
index d12d6cd..0c0f732 100644
--- a/scripts/makefile.hpgcc
+++ b/scripts/makefile.hpgcc
@@ -41,7 +41,7 @@
 #RANLIB=echo
 
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux
index 47b5c26..33692ae 100644
--- a/scripts/makefile.hpux
+++ b/scripts/makefile.hpux
@@ -24,7 +24,7 @@
 RANLIB=ranlib
 
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
diff --git a/scripts/makefile.linux b/scripts/makefile.linux
index 9ba553b..d133832 100644
--- a/scripts/makefile.linux
+++ b/scripts/makefile.linux
@@ -5,7 +5,7 @@
 
 LIBNAME = libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CC=gcc
@@ -101,9 +101,9 @@
 	-o $(LIBNAME).so.$(PNGVER) \
 	$(OBJSDLL)
 
-libpng.so.3.$(PNGMIN): $(OBJSDLL)
-	$(CC) -shared -Wl,-soname,libpng.so.3 \
-	-o libpng.so.3.$(PNGMIN) \
+libpng.so.0.$(PNGMIN): $(OBJSDLL)
+	$(CC) -shared -Wl,-soname,libpng.so.0 \
+	-o libpng.so.0.$(PNGMIN) \
 	$(OBJSDLL)
 
 pngtest: pngtest.o $(LIBNAME).so
@@ -139,20 +139,20 @@
 	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -sf libpng.so.3 libpng.so; \
+	ln -sf libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -sf libpng.so.0 libpng.so; \
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -206,7 +206,7 @@
 clean:
 	/bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	libpng.pc
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
diff --git a/scripts/makefile.ne12bsd b/scripts/makefile.ne12bsd
index 17d317b..3e043d7 100644
--- a/scripts/makefile.ne12bsd
+++ b/scripts/makefile.ne12bsd
@@ -13,7 +13,7 @@
 
 LIB=	png12
 SHLIB_MAJOR=	0
-SHLIB_MINOR=	1.2.8
+SHLIB_MINOR=	1.2.9beta1
 SRCS=	pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
 		pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
 		pngwtran.c pngmem.c pngerror.c pngpread.c
diff --git a/scripts/makefile.netbsd b/scripts/makefile.netbsd
index 52fa339..a596b71 100644
--- a/scripts/makefile.netbsd
+++ b/scripts/makefile.netbsd
@@ -13,7 +13,7 @@
 
 LIB=	png
 SHLIB_MAJOR=	3
-SHLIB_MINOR=	1.2.8
+SHLIB_MINOR=	1.2.9beta1
 SRCS=	pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
 		pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
 		pngwtran.c pngmem.c pngerror.c pngpread.c
diff --git a/scripts/makefile.openbsd b/scripts/makefile.openbsd
index 5d401a3..9ecf962 100644
--- a/scripts/makefile.openbsd
+++ b/scripts/makefile.openbsd
@@ -7,7 +7,7 @@
 MANDIR= ${PREFIX}/man/cat
 
 SHLIB_MAJOR=	0
-SHLIB_MINOR=	1.2.8
+SHLIB_MINOR=	1.2.9beta1
 
 LIB=	png
 SRCS=	png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index f364231..eec1296 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -24,7 +24,7 @@
 RANLIB=echo
 
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
@@ -88,8 +88,8 @@
 	$(CC) -G  -Wl,-h,$(LIBNAME).so.$(PNGMAJ) -o $(LIBNAME).so.$(PNGVER) \
 	 $(OBJSDLL)
 
-libpng.so.3.$(PNGMIN): $(OBJSDLL)
-	$(CC) -G  -Wl,-h,libpng.so.3 -o libpng.so.3.$(PNGMIN) \
+libpng.so.0.$(PNGMIN): $(OBJSDLL)
+	$(CC) -G  -Wl,-h,libpng.so.0 -o libpng.so.0.$(PNGMIN) \
 	$(OBJSDLL)
 
 pngtest: pngtest.o $(LIBNAME).so
@@ -117,20 +117,20 @@
 	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -f -s libpng.so.3 libpng.so; \
+	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -f -s libpng.so.0 libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -184,7 +184,7 @@
 clean:
 	/bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	libpng.pc
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc
index 5010daa..64ef06e 100644
--- a/scripts/makefile.sggcc
+++ b/scripts/makefile.sggcc
@@ -18,7 +18,7 @@
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 CC=gcc
 
@@ -31,7 +31,7 @@
 LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
 LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ) \
   -set_version sgi$(PNGMAJ).0
-LDLEGACY=cc $(ABI) -shared -soname libpng.so.3 \
+LDLEGACY=cc $(ABI) -shared -soname libpng.so.0 \
   -set_version sgi$3.0
 # See "man dso" for info about shared objects
 
@@ -96,7 +96,7 @@
 	$(LDSHARED) -o $@ $(OBJS)
 	rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
 
-libpng.so.3.$(PNGMIN): $(OBJS)
+libpng.so.0.$(PNGMIN): $(OBJS)
 	$(LDLEGACY) -o $@ $(OBJS)
 
 pngtest: pngtest.o libpng.a
@@ -124,20 +124,20 @@
 	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -sf libpng.so.3 libpng.so; \
+	ln -sf libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -sf libpng.so.0 libpng.so; \
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -195,7 +195,7 @@
 clean:
 	rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	so_locations
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
diff --git a/scripts/makefile.sgi b/scripts/makefile.sgi
index 584da7c..418621b 100644
--- a/scripts/makefile.sgi
+++ b/scripts/makefile.sgi
@@ -5,7 +5,7 @@
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 # Where make install puts libpng.a, libpng12.so, and libpng12/png.h
@@ -36,7 +36,7 @@
 LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
 LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ) \
   -set_version sgi$(PNGMAJ).0
-LDLEGACY=cc $(ABI) -shared -soname libpng.so.3 \
+LDLEGACY=cc $(ABI) -shared -soname libpng.so.0 \
   -set_version sgi$3.0
 # See "man dso" for info about shared objects
 
@@ -102,7 +102,7 @@
 	$(LDSHARED) -o $@ $(OBJS)
 	rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
 
-libpng.so.3.$(PNGMIN): $(OBJS)
+libpng.so.0.$(PNGMIN): $(OBJS)
 	$(LDLEGACY) -o $@ $(OBJS)
 
 pngtest: pngtest.o libpng.a
@@ -130,20 +130,20 @@
 	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -sf libpng.so.3 libpng.so; \
+	ln -sf libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -sf libpng.so.0 libpng.so; \
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -201,7 +201,7 @@
 clean:
 	rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	so_locations
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
diff --git a/scripts/makefile.so9 b/scripts/makefile.so9
index a53a80d..75fa4d8 100644
--- a/scripts/makefile.so9
+++ b/scripts/makefile.so9
@@ -34,7 +34,7 @@
 RANLIB=echo
 
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
@@ -110,9 +110,9 @@
 	$(LD) -G -h $(LIBNAME).so.$(PNGMAJ) \
 	 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
 
-libpng.so.3.$(PNGMIN): $(OBJS)
-	$(LD) -G -h libpng.so.3 \
-	 -o libpng.so.3.$(PNGMIN) $(OBJSDLL)
+libpng.so.0.$(PNGMIN): $(OBJS)
+	$(LD) -G -h libpng.so.0 \
+	 -o libpng.so.0.$(PNGMIN) $(OBJSDLL)
 
 pngtest: pngtest.o $(LIBNAME).so
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
@@ -137,20 +137,20 @@
 	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -f -s libpng.so.3 libpng.so; \
+	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -f -s libpng.so.0 libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -206,7 +206,7 @@
 clean:
 	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	libpng.pc
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris
index 8e053f8..51e0181 100644
--- a/scripts/makefile.solaris
+++ b/scripts/makefile.solaris
@@ -30,7 +30,7 @@
 RANLIB=echo
 
 PNGMAJ = 0
-PNGMIN = 1.2.8
+PNGMIN = 1.2.9beta1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
@@ -107,9 +107,9 @@
 	$(LD) -G -h $(LIBNAME).so.$(PNGMAJ) \
 	 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
 
-libpng.so.3.$(PNGMIN): $(OBJS)
-	$(LD) -G -h libpng.so.3 \
-	 -o libpng.so.3.$(PNGMIN) $(OBJSDLL)
+libpng.so.0.$(PNGMIN): $(OBJS)
+	$(LD) -G -h libpng.so.0 \
+	 -o libpng.so.0.$(PNGMIN) $(OBJSDLL)
 
 pngtest: pngtest.o $(LIBNAME).so
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
@@ -134,20 +134,20 @@
 	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
-	libpng.so.3.$(PNGMIN)
+	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
 	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
 	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.3
-	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
+	-@/bin/rm -f $(DL)/libpng.so.0
+	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
-	cp libpng.so.3.$(PNGMIN) $(DL)
+	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
-	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
+	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
-	ln -f -s libpng.so.3 libpng.so; \
+	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
+	ln -f -s libpng.so.0 libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
@@ -203,7 +203,7 @@
 clean:
 	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
-	libpng.so.3.$(PNGMIN) \
+	libpng.so.0.$(PNGMIN) \
 	libpng.pc
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
diff --git a/scripts/pngos2.def b/scripts/pngos2.def
index 9aa6135..b325ada 100644
--- a/scripts/pngos2.def
+++ b/scripts/pngos2.def
@@ -2,7 +2,7 @@
 ; PNG.LIB module definition file for OS/2
 ;----------------------------------------
 
-; Version 1.2.8
+; Version 1.2.9beta1
 
 LIBRARY		PNG
 DESCRIPTION	"PNG image compression library for OS/2"
@@ -213,6 +213,15 @@
 ; Added at version 1.2.7
   png_set_add_alpha
 
+; Added at version 1.2.9
+  png_get_uint_32
+  png_save_uint_32
+  png_get_uint_16
+  png_save_uint_16
+  png_get_int_32
+  png_save_int_32
+  png_get_uint_31
+
 ; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS
   png_libpng_ver
   png_pass_start
diff --git a/scripts/pngw32.def b/scripts/pngw32.def
index 8303bfe..438cc16 100644
--- a/scripts/pngw32.def
+++ b/scripts/pngw32.def
@@ -5,7 +5,7 @@
 LIBRARY
 
 EXPORTS
-;Version 1.2.8
+;Version 1.2.9beta1
   png_build_grayscale_palette  @1
   png_check_sig        @2
   png_chunk_error      @3
@@ -184,7 +184,7 @@
   png_convert_to_rfc1123     @172
   png_set_invalid  @173
 ; Added at version 1.0.12
-; For compatiblity with 1.0.7-1.0.11
+; For compatibility with 1.0.7-1.0.11
   png_info_init @174
   png_read_init_3    @175
   png_write_init_3    @176