diff -ruBbiw gil/boost/gil/extension/io/png_io_private.hpp boost/boost/include/boost-1_34/boost/gil/extension/io/png_io_private.hpp --- gil/boost/gil/extension/io/png_io_private.hpp 2007-05-11 01:32:39.000000000 +0100 +++ boost/boost/include/boost-1_34/boost/gil/extension/io/png_io_private.hpp 2007-08-06 11:05:06.000000000 +0100 @@ -20,6 +20,7 @@ #include #include +#include #include #include "../../gil_all.hpp" #include "io_error.hpp" @@ -162,6 +163,10 @@ png_init_io(_png_ptr, get()); png_set_sig_bytes(_png_ptr,PNG_BYTES_TO_CHECK); png_read_info(_png_ptr, _info_ptr); +#ifdef BOOST_LITTLE_ENDIAN + if (16 == png_get_bit_depth (_png_ptr, _info_ptr)) + png_set_swap (_png_ptr); +#endif } public: png_reader(FILE* file ) : file_mgr(file) { init(); } @@ -337,6 +342,11 @@ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT); png_write_info(_png_ptr,_info_ptr); +#ifdef BOOST_LITTLE_ENDIAN + if (16 == png_write_support_private::type + , typename color_space_type::type>::bit_depth) + png_set_swap(_png_ptr); +#endif std::vector::type, layout::type> > > row(view.width()); for(int y=0;y