diff options
author | Joseph Eagar <joeedh@gmail.com> | 2010-09-04 09:31:25 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2010-09-04 09:31:25 +0400 |
commit | bb7339a7aec37bdb2ee8a21599e6c65b37ef1277 (patch) | |
tree | 6fb8da94c6e43098c606f768e722484b04b8645c /source/blender/imbuf/intern/png.c | |
parent | 37f2c8a64c3277f100ab084ef1bb3846bc7b2c62 (diff) | |
parent | 8a320974f1b3e6004db3b3ad64f97742f878cbee (diff) |
merge with trunk at r31523
Diffstat (limited to 'source/blender/imbuf/intern/png.c')
-rw-r--r-- | source/blender/imbuf/intern/png.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 68a3324816c..6344b227174 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -31,6 +31,7 @@ #include "png.h" #include "BLI_blenlib.h" +#include "MEM_guardedalloc.h" #include "imbuf.h" @@ -103,6 +104,11 @@ int imb_savepng(struct ImBuf *ibuf, char *name, int flags) int i, bytesperpixel, color_type = PNG_COLOR_TYPE_GRAY; FILE *fp = 0; + /* use the jpeg quality setting for compression */ + int compression; + compression= (int)(((float)(ibuf->ftype & 0xff) / 11.1111f)); + compression= compression < 0 ? 0 : (compression > 9 ? 9 : compression); + bytesperpixel = (ibuf->depth + 7) >> 3; if ((bytesperpixel > 4) || (bytesperpixel == 2)) { printf("imb_savepng: unsupported bytes per pixel: %d\n", bytesperpixel); @@ -201,10 +207,10 @@ int imb_savepng(struct ImBuf *ibuf, char *name, int flags) PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG | PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH| PNG_ALL_FILTERS); - - png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); */ + png_set_compression_level(png_ptr, compression); + // png image settings png_set_IHDR(png_ptr, info_ptr, |