Patch to add all OpenEXR compression types
Posted: 2009-08-28T10:56:35-07:00
Hi,
I patched exr.c, options.c, and compress.h to support all of OpenEXR's compression formats: Piz, Pxr24, Zip, ZipS, B44 and B44A.
Here's the patch (generated with svn diff on ImageMagick 6.5.5):
cheers,
-Mark
I patched exr.c, options.c, and compress.h to support all of OpenEXR's compression formats: Piz, Pxr24, Zip, ZipS, B44 and B44A.
Here's the patch (generated with svn diff on ImageMagick 6.5.5):
Code: Select all
Index: magick/compress.h
===================================================================
--- magick/compress.h (revision 1440)
+++ magick/compress.h (working copy)
@@ -37,7 +37,12 @@
LosslessJPEGCompression,
LZWCompression,
RLECompression,
- ZipCompression
+ ZipCompression,
+ ZipSCompression,
+ PizCompression,
+ Pxr24Compression,
+ B44Compression,
+ B44ACompression
} CompressionType;
typedef struct _Ascii85Info
Index: magick/option.c
===================================================================
--- magick/option.c (revision 1440)
+++ magick/option.c (working copy)
@@ -754,6 +754,11 @@
{ "RLE", (long) RLECompression, MagickFalse },
{ "Zip", (long) ZipCompression, MagickFalse },
{ "RunlengthEncoded", (long) RLECompression, MagickFalse },
+ { "ZipS", (long) ZipSCompression, MagickFalse },
+ { "Piz", (long) PizCompression, MagickFalse },
+ { "Pxr24", (long) Pxr24Compression, MagickFalse },
+ { "B44", (long) B44Compression, MagickFalse },
+ { "B44A", (long) B44ACompression, MagickFalse },
{ (char *) NULL, (long) UndefinedCompression, MagickFalse }
},
ColorspaceOptions[] =
Index: coders/exr.c
===================================================================
--- coders/exr.c (revision 1440)
+++ coders/exr.c (working copy)
@@ -387,8 +387,20 @@
image->rows-1);
ImfHeaderSetDisplayWindow(hdr_info,0,0,(int) image->columns-1,(int)
image->rows-1);
- ImfHeaderSetCompression(hdr_info,write_info->compression == NoCompression ?
- IMF_NO_COMPRESSION : IMF_PIZ_COMPRESSION);
+ if (write_info->compression == ZipSCompression)
+ ImfHeaderSetCompression(hdr_info,IMF_ZIPS_COMPRESSION);
+ else if (write_info->compression == ZipCompression)
+ ImfHeaderSetCompression(hdr_info,IMF_ZIP_COMPRESSION);
+ else if (write_info->compression == PizCompression)
+ ImfHeaderSetCompression(hdr_info,IMF_PIZ_COMPRESSION);
+ else if (write_info->compression == Pxr24Compression)
+ ImfHeaderSetCompression(hdr_info,IMF_PXR24_COMPRESSION);
+ else if (write_info->compression == B44Compression)
+ ImfHeaderSetCompression(hdr_info,IMF_B44_COMPRESSION);
+ else if (write_info->compression == B44ACompression)
+ ImfHeaderSetCompression(hdr_info,IMF_B44A_COMPRESSION);
+ else
+ ImfHeaderSetCompression(hdr_info,IMF_NO_COMPRESSION);
ImfHeaderSetLineOrder(hdr_info,IMF_INCREASING_Y);
file=ImfOpenOutputFile(write_info->filename,hdr_info,IMF_WRITE_RGBA);
ImfDeleteHeader(hdr_info);
-Mark