diff options
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, |