diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-07-17 17:29:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-07-17 17:29:55 +0400 |
commit | 22c6b7d174ec7158acc526821b002d9703cf4f56 (patch) | |
tree | 68ac54748cefe19c105709230be79e1deb7b6812 /source/blender/imbuf/intern | |
parent | 30b712ed68dd72583357180741e845efb5952ad9 (diff) |
PNG Compression can now be set, writing uncompressed PNG's is significantly faster for high resolution images - 2k.
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/png.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 68a3324816c..4df8d8a2271 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -103,6 +103,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 +206,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, |