diff options
author | Soumith Chintala <soumith@gmail.com> | 2015-08-29 01:54:23 +0300 |
---|---|---|
committer | Soumith Chintala <soumith@gmail.com> | 2015-08-29 01:54:23 +0300 |
commit | 20ee81e349a6643f5aa112038ce89e12662df809 (patch) | |
tree | 8392957378c37eb96ad84640f68b7c711bdec3b7 | |
parent | 546daab1736db93690f2dabb915b555f4f294bda (diff) | |
parent | 3d268eae9ca243d5a63c3e15ce661a2871191ab3 (diff) |
Merge pull request #95 from edward-zhu/pngfix
fixed open 1-bit png on Mac
-rwxr-xr-x | generic/png.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/generic/png.c b/generic/png.c index b98028a..4c22a23 100755 --- a/generic/png.c +++ b/generic/png.c @@ -96,7 +96,7 @@ static int libpng_(Main_load)(lua_State *L) height = png_get_image_height(png_ptr, info_ptr); color_type = png_get_color_type(png_ptr, info_ptr); bit_depth = png_get_bit_depth(png_ptr, info_ptr); - png_read_update_info(png_ptr, info_ptr); + /* get depth */ int depth = 0; @@ -109,7 +109,6 @@ static int libpng_(Main_load)(lua_State *L) if(bit_depth < 8) { png_set_expand_gray_1_2_4_to_8(png_ptr); - png_read_update_info(png_ptr, info_ptr); } depth = 1; } @@ -119,7 +118,6 @@ static int libpng_(Main_load)(lua_State *L) { depth = 3; png_set_expand(png_ptr); - png_read_update_info(png_ptr, info_ptr); } else luaL_error(L, "[read_png_file] Unknown color space"); @@ -127,8 +125,9 @@ static int libpng_(Main_load)(lua_State *L) if(bit_depth < 8) { png_set_strip_16(png_ptr); - png_read_update_info(png_ptr, info_ptr); } + + png_read_update_info(png_ptr, info_ptr); /* read file */ if (setjmp(png_jmpbuf(png_ptr))) |