Converting ACEScg EXR file to jpeg - Can't get correct output

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
oumoumad
Posts: 5
Joined: 2017-11-02T05:29:41-07:00
Authentication code: 1152

Converting ACEScg EXR file to jpeg - Can't get correct output

Post by oumoumad »

I'm trying to convert a exr file that I rendered out from maya using the Rendering Space ACEScg, the expected image as seen in maya with the view transform "ACES RRT v1.0", should be like this :
https://s1.postimg.org/54linzcocv/correct_Output.jpg

but I keep getting only this :
https://s1.postimg.org/10s7idzgj3/image ... result.jpg
which looks like the view transform of sRGB in maya.

You can download the exr file here : https://we.tl/npE97QH7CH

This is what I get with identify -verbose on the exr file :
Format: EXR (High Dynamic-range (HDR))
Class: DirectClass
Geometry: 4096x4096+0+0
Units: Undefined
Type: TrueColorAlpha
Endianess: Undefined
Colorspace: RGB
Depth: 16-bit
Channel depth:
Red: 16-bit
Green: 16-bit
Blue: 1-bit
Alpha: 1-bit
Channel statistics:
Pixels: 16777216
Red:
min: 43 (0.000656138)
max: 65535 (1)
mean: 14806.8 (0.225938)
standard deviation: 18953.6 (0.289214)
kurtosis: 1.77868
skewness: 1.71012
entropy: 0.943941
Green:
min: 370 (0.00564584)
max: 65535 (1)
mean: 13447.9 (0.205202)
standard deviation: 19282.3 (0.29423)
kurtosis: 1.91877
skewness: 1.76845
entropy: 0.940277
Blue:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: 0 (0)
kurtosis: -3
skewness: 0
entropy: -1.#IND
Alpha:
min: 65535 (1)
max: 65535 (1)
mean: 65535 (1)
standard deviation: -1.#IND (-1.#IND)
kurtosis: 3.21998e+069
skewness: 8.19225e+049
entropy: -1.#IND
Image statistics:
Overall:
min: 0 (0)
max: 65535 (1)
mean: 23447.4 (0.357785)
standard deviation: 28402.7 (0.433397)
kurtosis: -1.37632
skewness: 0.696918
entropy: -1.#IND
Rendering intent: Undefined
Gamma: 1
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 4096x4096+0+0
Dispose: Undefined
Iterations: 0
Compression: Undefined
Orientation: Undefined
Properties:
date:create: 2017-11-02T11:56:03+01:00
date:modify: 2017-11-02T12:01:42+01:00
signature: 0f09ca50580bea9f0bf7e2e36ad16d2e4e981db5201434ffb719856ceba87b
Artifacts:
verbose: true
Tainted: False
Filesize: 17.3666MiB
Number pixels: 16.7772M
Pixels per second: 13.9694MB
User time: 1.201u
Elapsed time: 0:02.201
Version: ImageMagick 7.0.6-0 Q16 x64 2017-06-11 http://www.imagemagick.org
I tried using -profile with elle stone''s icc files : https://github.com/ellelstone/elles_icc ... r/profiles but it still outputs the same thing.

I've spent so much time trying to figure this out, there's definitely something I didn't understand right yet ^^', so if someone can help that would be super appreciated !
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by fmw42 »

Looking at your files, your input has a blue channel with all values=0. Your correct output has non-zero values. It seems to me that it has been created after processing your exr file. It is not just a colorspace issue that I can see. I tried converting to both linear and non-linear RGB and could not get a match. The exr file is linear RGB with gamma=1.

What is maya with the view transform "ACES RRT v1.0". Perhaps that is what is modifying your exr file.
oumoumad
Posts: 5
Joined: 2017-11-02T05:29:41-07:00
Authentication code: 1152

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by oumoumad »

fmw42 wrote: 2017-11-02T09:55:25-07:00 Looking at your files, your input has a blue channel with all values=0. Your correct output has non-zero values. It seems to me that it has been created after processing your exr file. It is not just a colorspace issue that I can see. I tried converting to both linear and non-linear RGB and could not get a match. The exr file is linear RGB with gamma=1.

What is maya with the view transform "ACES RRT v1.0". Perhaps that is what is modifying your exr file.
I believe the reason why the blue channel is 0 in the input file is because the plane I rendered has a gradient from green to red, and no blue.
"ACES RRT v1.0" is the colorspace (the LUT) maya uses to display the render, kinda like "sRGB gamma" or "rec 709 gamma" etc... So it's not in the input file.

Maybe if you look at my colorspace settings in maya you'll understand better : https://s1.postimg.org/3yfvfribtr/Screenshot_8.jpg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by fmw42 »

I cannot get to your link. "Connection is Not Private" message about possible security issues.

But your input image has no profile that represents that colorspace. If there is a special lut used to display the image, then we would need to see the lut to see if it can be applied to your exr image when converting to jpg.
oumoumad
Posts: 5
Joined: 2017-11-02T05:29:41-07:00
Authentication code: 1152

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by oumoumad »

I would imagine this is the lut I need? https://github.com/ellelstone/elles_icc ... rgbtrc.icc
but even when I added it with -profile path/to/ACEScg-elle-V4-srgbtrc.icc it still gives the same output as if I didn't add the profile.

Regarding the image I shared, I just tested it works you just need to click ""advanced" in the bottom and then proceed. Or you can leave it if you're concerned it might have security problems.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by fmw42 »

I tried the following in HDRI and non-hdri Imagemagemagick 6.9.8.10, but still no match. (Note your EXR file has values outside the normal range of 16-bits, thus the use of HDRI Q16)

Code: Select all

convert ACES_output_16bit.exr -profile /Users/fred/images/profiles/ACEScg-elle-V4-srgbtrc.icc -sampling-factor 2x2 -depth 8 result1.jpg

convert ACES_output_16bit.exr -profile /Users/fred/images/profiles/ACEScg-elle-V4-srgbtrc.icc -profile /Users/fred/images/profiles/sRGB.icc -sampling-factor 2x2 -depth 8 result2.jpg

convert ACES_output_16bit.exr -profile /Users/fred/images/profiles/sRGB.icc -profile /Users/fred/images/profiles/ACEScg-elle-V4-srgbtrc.icc -sampling-factor 2x2 -depth 8 result3.jpg
oumoumad
Posts: 5
Joined: 2017-11-02T05:29:41-07:00
Authentication code: 1152

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by oumoumad »

Thank you for your tests.

Yeh it's really complicated for a user like me who only expects to take an input and give it the right LUT and that's it XD. I hope someone more knowledgeable in the subject who already made it work would share the solution.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by fmw42 »

Could you share how you created the EXR file? Also what you do in Maya to view the file? Is there any processing that you do or is there some automatic processing that Maya does via some default settings. Does it happen with all EXR files? Can you get some other generic EXR file via a Google search and use it? Perhaps Maya does some kind of power law or exponential processing of the image to force it into a normal range of values.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by fmw42 »

Here is a really dark EXR file:

http://www.fmwconcepts.com/misc_tests/e ... _small.exr

Using HDRI Q16 ImageMagick, I get the following conversion without and with your profile. Note since it is so dark, I had to use -evaluate log to enhance.

Code: Select all

convert doll_small.exr -alpha off -evaluate log 10000 doll1.png
Image

Code: Select all

convert doll_small.exr -alpha off -profile /Users/fred/images/profiles/ACEScg-elle-V4-srgbtrc.icc -evaluate log 10000 doll2.png
Image

Do either of these look the same in your Maya display?

Note that ImageMagick only handles EXR "half" format last I was aware.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by fmw42 »

Here is a better example downloaded from https://lists.nongnu.org/archive/html/o ... 00081.html

http://www.fmwconcepts.com/misc_tests/e ... rGamut.exr

Using HDRI Q16 ImageMagick, I get the following conversion without and with your profile.

Code: Select all

convert doll_small.exr -alpha off 10000 WideColorGamut1.jpg
Image

Code: Select all

convert doll_small.exr -alpha off -profile /Users/fred/images/profiles/ACEScg-elle-V4-srgbtrc.icc 10000 WideColorGamut2. jpg
Image


I see little difference in the JPG output (using Mac Preview)

But with PNG output, they display differently. (using Mac Preview)

Code: Select all

convert doll_small.exr -alpha off 10000 WideColorGamut1.png
Image

Code: Select all

convert doll_small.exr -alpha off -profile /Users/fred/images/profiles/ACEScg-elle-V4-srgbtrc.icc 10000 WideColorGamut2.png
Image

Do either of these look the same in your Maya display?

Note that ImageMagick only handles EXR "half" format last I was aware.
oumoumad
Posts: 5
Joined: 2017-11-02T05:29:41-07:00
Authentication code: 1152

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by oumoumad »

Thank you for all your tests !

It seems that the EXR files you converted are created in linear space, and not ACEScg. Which has always worked fine for me when I was in that workflow, meaning rendering EXR files in linear space and viewing them with sRGB transforms. And the workflow looked like this in Maya :
https://postimg.org/image/vb566s0x1/
As you can see "Rendering space : scene-linear Rec 709/sRGB" and "View Transform sRGB gamma". And with that I converted exr files to jpeg without a problem and without needing to specify any profile etc..

However today we switched our workflow, instead of working with linear space to sRGB, we are using ACES. And since I'm still new to this, I can't give a proper technical explanation of the difference, the only thing I can tell you now is this color space allows us to have a much better natural light and color diffusion in our renderings.
So in this case we need to render the EXR in ACEScg and display it with ACES RRT as you can see in this maya settings :
https://postimg.org/image/bjdp2nxhn/

I'm not 100% sure that the icc profile I shared is the one to use by the way. It's just something I found that I thought might be what I needed.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting ACEScg EXR file to jpeg - Can't get correct output

Post by fmw42 »

Often the profile is imbedded in the file. So post one of your new EXR files and your exported JPG and I will see what I make of those.
Post Reply