1

I encountered some issues to combine EXR. With PNG or anything else, no problem (with ImageMagick).

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 :

$ 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 ImageMagick simple commands like

$ 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.

I am open to any solution with any language or any software, working on Debian.

Edit : The 4 EXR tiles can be found here : https://www.dropbox.com/sh/p6h8kh5wlroy5bb/AACMuR8WieZ-SqB3qXHFwk_ea?dl=0 (These are the "imput_tile...exr").

Any idea?

pierallard
  • 3,326
  • 3
  • 21
  • 48

1 Answers1

1

I am no expert on (ok, I have never even seen any) EXR format images but I know that vips is able to process them. I can't even tell what your images look like but I think/hope this might be doing what you want.

First, I inspect your images and see they are 4 bands of 400x225 pixels like this

vips im_printdesc input_tile_0000.exr
400x225 float, 4 bands, srgb, setbuf VipsImage (0x7fda0984f000) count=1 9600 bytes
width: 400
height: 225
bands: 4
format: 6 - float
coding: 0 - none
interpretation: 22 - srgb
xoffset: 0
yoffset: 0
xres: 1.000000
yres: 1.000000
filename: "input_tile_0000.exr"

Then I do a left-right join to get the top row of your desired result:

vips im_lrjoin *0.exr *1.exr top.v

Then I do another left-right join to get the bottom row of your desired result:

vips im_lrjoin *2.exr *3.exr bot.v

Then I do a top-bottom join to join the top and bottom to get the final result:

vips im_tbjoin top.v bot.v result.v

And if I look at it, it appears to have the correct dimensions and the same number of bands and coding as your originals:

vips im_printdesc result.v
800x450 float, 4 bands, srgb, openin VipsImage (0x7f975b84d010) count=1
width: 800
height: 450
bands: 4
format: 6 - float
coding: 0 - none
interpretation: 22 - srgb
xoffset: 0
yoffset: 0
xres: 1.000000
yres: 1.000000
filename: "result.v"

Notes

  1. The xyz.v format is vips's internal, efficient image format

  2. vips is available with bindings to many languages - see the vips website here.

  3. It may be able to cache the intermediate files I create (top.v and bot.v), but I have no idea how

  4. The vips maintainer is on SO as @user894763 and he may be able to throw more light on my musings - hopefully!

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • Hi Mark! Looks fine. The vips8 way is `vips join 0000.exr 0001.exr top.v horizontal`, it'd be a little quicker. vips does not have exr write, you'd need to use RAD or PFM or TIFF for output. If you want to avoid creating the two intermediate images, you'd need to use the Ruby / Python / Javascript / whatever bindings. – jcupitt Jun 28 '15 at 16:56
  • @user894763 Thanks again for your inputs. The lack of an EXR writer maybe rather defeats the object of this particular exercise :-( – Mark Setchell Jun 28 '15 at 17:54
  • Nice answer @MarkSetchell . Seems full of promise. I do all your operations (regardless to version, I have vips7). So now, how can I open this "vips" format ? Or better : how to "translate" it to EXR ? – pierallard Jun 28 '15 at 22:01
  • @pierallard with recent imagemagick you can use "convert" to change vips to exr, or you can write something like .tif from vips. I think your input images are all black though, so you will get a black output. – jcupitt Jun 29 '15 at 08:03