Combine EXR keeping layers information

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
ForgetTheNorm
Posts: 4
Joined: 2015-06-26T10:15:12-07:00
Authentication code: 6789

Combine EXR keeping layers information

Post by ForgetTheNorm »

Hi everybody

First, sorry for my poor english.

I encountered some issues using imagemagick to combine EXR. With PNG or anything else, no problem.
I have 4 images at same size, which should be combined to get a bigger image. Each image represents a part of the bigger image (top left, top right, bottom left and bottom right). Each image contains N layers with information (colors, depth, etc). Theses layers must be combined in the final image.

Each image has this signature :

Code: Select all

$ identify imput_tile_0001.exr
imput_tile_0001.exr EXR 400x225 400x225+0+0 16-bit DirectClass 2.501MB 0.000u 0:00.000
I try simple commands as

Code: Select all

$ convert +append *.exr out.exr
$ montage *.exr -tile 2x2 -geometry +0+0 out.exr
Theses commands returns a totally black image, with the correct size, and with only 1 layer.

How can I do this ?

Regards
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine EXR keeping layers information

Post by fmw42 »

I am not sure IM handles layers EXR images. From convert -list format, I see that it does not support layers as best as I can tell, since it shows - and not +

Code: Select all

EXR  EXR       rw-   High Dynamic-range (HDR)

* native blob support
r read support
w write support
+ support for multiple images  << I think this means layers or frames or pages

But the current IM 6 syntax is to put the input image(s) right after the convert, so

Code: Select all

convert *.exr +append out.exr
IM is often forgiving and this may not help.

You will have to hear from the developers about layered EXR images.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine EXR keeping layers information

Post by fmw42 »

Can you convert a layered EXR to some other layered format such as TIFF, just to see if IM preserves the layers?
ForgetTheNorm
Posts: 4
Joined: 2015-06-26T10:15:12-07:00
Authentication code: 6789

Re: Combine EXR keeping layers information

Post by ForgetTheNorm »

Thanks for your replies.

A simple convert IM call from EXR to TIFF generates a complete black TIFF with only one layer.
The source images comes from Blender, it can generate a lot of formats. The generation of a TIFF returns a one-layer image.

Regards
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine EXR keeping layers information

Post by fmw42 »

Probably means that IM does not support layered EXR images or there is a bug. The IM developers would have to comment.

Try separating one layered EXR image into separate image one for each layer. Then try recombining them as a layered EXR images. Does that work as a test if IM supports layered EXR.

If that works, then try separating each layer of all your images, append them, then recombine each appended layer into a new layered EXR.

Can you convert from a layered tiff to a layered EXR?

What is your IM version and platform? Always provide that!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Combine EXR keeping layers information

Post by magick »

Post a URL to your EXR image. We'll need to inspect it before we can comment further.
ForgetTheNorm
Posts: 4
Joined: 2015-06-26T10:15:12-07:00
Authentication code: 6789

Re: Combine EXR keeping layers information

Post by ForgetTheNorm »

Hi

The 4 EXR tiles can be found here :
https://www.dropbox.com/sh/p6h8kh5wlroy ... wk_ea?dl=0
(This is the "imput_tile...exr").

The imagemagick version is 6.8.9.9-5.

I found a python script using OpenEXR library for separate layers, but none to create a new Multilayered EXR...

Pierre
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine EXR keeping layers information

Post by fmw42 »

Magick: See 2.2 release of OpenEXR and documentation at http://www.openexr.com/ReadingAndWritingImageFiles.pdf and http://www.openexr.com/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Combine EXR keeping layers information

Post by magick »

ImageMagick uses the RGBA-only interface for scan line based files to the OpenEXR delegate library, see http://www.openexr.com/ReadingAndWritingImageFiles.pdf. Any limitations this interface imposes on EXR files are inherited by ImageMagick. We did try some of the tools that are distributed with the OpenEXR delegate library, and they do show your images as all black.
ForgetTheNorm
Posts: 4
Joined: 2015-06-26T10:15:12-07:00
Authentication code: 6789

Re: Combine EXR keeping layers information

Post by ForgetTheNorm »

magick wrote:We did try some of the tools that are distributed with the OpenEXR delegate library, and they do show your images as all black.
2 softwares opened it without any issue :
- Krita shows every layers http://www.pasteall.org/pic/show.php?id=89920
- Blender shows every "main" layers ; when I select one layer, I can select a "sub-layer" http://www.pasteall.org/pic/show.php?id=89919

How did you opened theses files ? I'm on Ubuntu 14 here.
jan.majlath
Posts: 2
Joined: 2019-08-01T02:46:10-07:00
Authentication code: 1152

Re: Combine EXR keeping layers information

Post by jan.majlath »

Any update in this topic ?
I would like to join (one image next to another) two EXR Multilayer images - and preserve layers (both images have the same layers).
For example, I have two images 300 pixels x 300 pixels. After joining I would like to have image 600 pixels x 300 pixels, and the same layers that original images have.
Is it possible to do this with Imagemagick ?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Combine EXR keeping layers information

Post by snibgo »

magick -list format |grep EXR
EXR EXR rw- High Dynamic-range (HDR)
So the version of IM that I use (v7.0.7-28) can read and write EXR, but does not support multiple images in the EXR.
snibgo's IM pages: im.snibgo.com
jan.majlath
Posts: 2
Joined: 2019-08-01T02:46:10-07:00
Authentication code: 1152

Re: Combine EXR keeping layers information

Post by jan.majlath »

Yes, Imagemagick support EXR files and it is possible to append images (vertically and also horizontally), but I need append multilayer EXR files. When I try to append multilayer exr files, output is completely black image and layers "gone away".
Post Reply