Page 1 of 1

Unable to save to EXR compressing with the DWAA method

Posted: 2019-08-07T00:37:29-07:00
by levivant
Hi there !

I'm a long time user of imagemagick which I love, and for the first time I'm facing an issue I can't find any help around. So here is my first post here !

I'm in need of saving exr images after making some convert magics. Everything is working fine with the Exr, except I can't use the DWAA or DWAB compression format. Every other EXR compression method looks to be working fine (None, Zip, Piz, B44, PXR24, etc.) except from the two official DWA methods, which are not available.

I'm on windows, with the last stable release of ImageMagick

Here is the command I'm using

Code: Select all

convert.exe input [...] -compress Piz output.exr
And when I'm trying Dwaa I got the following error :

Code: Select all

convert.exe: unrecognized image compression `Dwaa' @ error/convert.c/ConvertImageCommand/1147.

Here is the list of compression methods where Dwaa is missing of course :

Code: Select all

convert.exe -list compress
B44A
B44
BZip
DXT1
DXT3
DXT5
Fax
Group4
JBIG1
JBIG2
JPEG2000
JPEG
LosslessJPEG
Lossless
LZMA
LZW
None
Piz
Pxr24
RLE
RunlengthEncoded
WebP
ZipS
Zip
Zstd
And yet, apparently, the DWA method looks to be in the github repo of imagemagick : https://github.com/ImageMagick/exr/blob ... ressor.cpp
Or also here perfectly listed on the exr list of compression methods : https://github.com/ImageMagick/exr/blob ... n.cpp#L151
Maybe the absence of Dwaa is on purpose ? Or maybe I'm not using the right parameter ?

Have a nice day !
Flavio

Re: Unable to save to EXR compressing with the DWAA method

Posted: 2019-08-07T04:49:29-07:00
by magick
We leverage the OpenEXR delegate library to write EXR image files. OpenEXR only supports these compression methods:

Code: Select all

#define IMF_NO_COMPRESSION      0
#define IMF_RLE_COMPRESSION     1
#define IMF_ZIPS_COMPRESSION    2
#define IMF_ZIP_COMPRESSION     3
#define IMF_PIZ_COMPRESSION     4
#define IMF_PXR24_COMPRESSION   5
#define IMF_B44_COMPRESSION     6
#define IMF_B44A_COMPRESSION    7

Re: Unable to save to EXR compressing with the DWAA method

Posted: 2019-08-07T05:11:41-07:00
by levivant
Thanks for you answer and taking time to check the sources.
But... Why is it present in the source code I linked though ?
And DWAA is officially in the OpenEXR standard since 2.3 (2014). Maybe it's just a missing Define ?
The DWAA or DWAB are widely use for proxies because of their excellent lossy compression method

:(

Re: Unable to save to EXR compressing with the DWAA method

Posted: 2019-08-07T15:52:53-07:00
by levivant
Hi @magick!

I've been looking around to get a clear idea. And I'm thinking the issue is just a missing Define.

The code you provided looks to be coming from that file :
https://github.com/ImageMagick/exr/blob ... ile.h#L108

Just above that list of DEFINE, it is specified : "Compression types; values must be the same as in Imf::Compression"

And I've been looking for that lmf::Compression file, which looks to be the lmfCompression.h. And there we find the same list and index as you provided (or available in the link previously mentionned). But the two compression methods I'm looking for are also there, as you can see here : https://github.com/ImageMagick/exr/blob ... sion.h#L69
DWAA and DWAB are listed with the index 8 and 9

So my guess is that adding the missing DEFINE lines will allow compression in Exr with the DWAA/B method without more changes ?
But I don' know how to try that. I mean I guess I've to edit and then compile everything, but I've no experience on compiling such tool on windows. Any tutorial ?

Re: Unable to save to EXR compressing with the DWAA method

Posted: 2019-08-07T18:48:24-07:00
by snibgo
levivant wrote:... compiling such tool on windows. Any tutorial ?
http://www.imagemagick.org/script/install-source.php
And Compiling IM with Cygwin

Re: Unable to save to EXR compressing with the DWAA method

Posted: 2019-08-08T02:23:58-07:00
by levivant
Hi snibgo !
Thanks for the links, it helped a lot !

I did manage to activate DWAA/DWAB compression in minutes
I was close from right with the missing Defines (but not only in the file I pointed), the method and everything else was included in the source code already (since 2014 apparently)

There is a couple of new lines in the exr repository
but also in the ImageMagick one.. (coders/exr.c obviously, Magik++/lib/Magick++/Include.h and Magick++/MagickCore/compress.h)
So.. what's the next step if I want to share the fix ?
Should I do 2 pull requests on github (one for exr and the other one for ImageMagick ?)

EDIT : I've made 2 pull requests on github, and I'll see if it was the right way to do so :)

Thanks for your comments

Re: Unable to save to EXR compressing with the DWAA method

Posted: 2019-08-08T04:44:20-07:00
by dlemstra
Thanks for helping us out! I have responded to your pull requests.