Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Wenger <matpi@protonmail.ch>2016-01-14 13:02:13 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-01-14 13:33:46 +0300
commit370a8ee7417f37bbedf814582d9f14e855da0c3e (patch)
tree6419c5126e0d3b62b1ffc3fa7443a2a9eadfb372 /source/blender/blenkernel/intern/image.c
parent1f273cec00feddb1065847e3c8163cdcf8a6d89a (diff)
Add compression modes for TIFF images
This patch aims at providing multiple compression modes for TIFF output, particularly uncompressed mode. At this moment have None, Deflate, LZW and Pack Bits modes been integrated, mimicking The GIMP export modes (except JPEG mode, which returned encoding errors). More modes could be added if needed. Default remains Deflate. Reviewers: campbellbarton, mont29, sergey Differential Revision: https://developer.blender.org/D1709
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r--source/blender/blenkernel/intern/image.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 55cbf13ed34..95cf1ba987c 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1623,6 +1623,14 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
im_format->imtype = R_IMF_IMTYPE_TIFF;
if (custom_flags & TIF_16BIT)
im_format->depth = R_IMF_CHAN_DEPTH_16;
+ if (custom_flags & TIF_COMPRESS_NONE)
+ im_format->tiff_codec = R_IMF_TIFF_CODEC_NONE;
+ if (custom_flags & TIF_COMPRESS_DEFLATE)
+ im_format->tiff_codec = R_IMF_TIFF_CODEC_DEFLATE;
+ if (custom_flags & TIF_COMPRESS_LZW)
+ im_format->tiff_codec = R_IMF_TIFF_CODEC_LZW;
+ if (custom_flags & TIF_COMPRESS_PACKBITS)
+ im_format->tiff_codec = R_IMF_TIFF_CODEC_PACKBITS;
}
#endif
@@ -2208,8 +2216,21 @@ void BKE_imbuf_write_prepare(ImBuf *ibuf, const ImageFormatData *imf)
else if (imtype == R_IMF_IMTYPE_TIFF) {
ibuf->ftype = IMB_FTYPE_TIF;
- if (imf->depth == R_IMF_CHAN_DEPTH_16)
+ if (imf->depth == R_IMF_CHAN_DEPTH_16) {
ibuf->foptions.flag |= TIF_16BIT;
+ }
+ if (imf->tiff_codec == R_IMF_TIFF_CODEC_NONE) {
+ ibuf->foptions.flag |= TIF_COMPRESS_NONE;
+ }
+ else if (imf->tiff_codec== R_IMF_TIFF_CODEC_DEFLATE) {
+ ibuf->foptions.flag |= TIF_COMPRESS_DEFLATE;
+ }
+ else if (imf->tiff_codec == R_IMF_TIFF_CODEC_LZW) {
+ ibuf->foptions.flag |= TIF_COMPRESS_LZW;
+ }
+ else if (imf->tiff_codec == R_IMF_TIFF_CODEC_PACKBITS) {
+ ibuf->foptions.flag |= TIF_COMPRESS_PACKBITS;
+ }
}
#endif
#ifdef WITH_OPENEXR