Monday, June 4, 2012

dataWindow and displayWindow in OpenEXR files

All OpenEXR files contain two required attributes, dataWindow and displayWindow. Each gives the coordinates for a rectangle, the former describing the pixels stored in the file and the latter describing the viewer that the pixel data lives in. You can see these and other OpenEXR file attributes by viewing the ProEXR File Description in Photoshop.

For a standard OpenEXR file (including all files written by the ProEXR plug-ins), the dataWindow and displayWindow are the same, so you simply have pixels filling the view as you would for regular image files like JPEG or PNG.

But in some cases the dataWindow and the displayWindow may not match. For example, a 3D program with only a small object in the middle of frame might only have to store a 400x400 image within a full 1920x1080 frame, so the dataWindow will be smaller than the displayWindow.

Or an image may be rendered overscan, with pixels that stretch beyond the area you normally view. These pixels might be used if camera shake is added or to provide real edge pixels to use if the image is blurred. So you could have a 2120x1280 image and a 1920x1080 view.
(images borrowed from the Technical Introduction to OpenEXR on

Neither Photoshop nor After Effects have the notion of a display window from the perspective of a file importer, so ProEXR always reads in the full dataWindow, giving you access to all the pixels in the file. But once the file is imported, you can match the displayWindow by floating the Photoshop or After Effects layer inside a differently sized comp. ProEXR includes a Photoshop script and an After Effects plug-in to do the math for you and set this up automatically and precisely.

In Photoshop, run the "ProEXR displayWindow" script, included with ProEXR. It will scan the ProEXR File Description for the window data and automatically enter it into the dialog for you. If you have this information through some other method, you can enter it manually. When you click OK, the Photoshop canvas will be resized so that the original layer floats properly within it, all the original pixels maintained.

In After Effects with the ProEXR AE plug-in installed, select the EXR file and run File > Create ProEXR Layer Comps. In addition to everything this command usually does, a "display comp" will be created that matches the displayWindow and contains the assemble comp floating within it. A display comp will only be created if the displayWindow is different from the dataWindow.

If you have an image sequence in After Effects where the dataWindow changes every frame (perhaps because a small object is being animated), this presents a problem for After Effects, which usually expects every image in a sequence to be the same size. The easiest thing to do is force your renderer to store the whole frame if possible. Otherwise, the way to deal with it is to import the sequence as individual files—select all the files and uncheck the "OpenEXR Sequence" checkbox in the Import Dialog. Then select all these files in your project, hold down option/alt, and go back to the Comp Creator command which will now be renamed "ProEXR DisplayWindow Comp". The result will be a comp with all the files lined up in time, placed inside the comp appropriately. Use this comp as you would a piece of footage.

Update: ProEXR 1.9 for After Effects will handle displayWindow for you without using the Comp Creator.

If you'd like a sample of displayWindow behavior to experiment with, download the file at the bottom of the fnord OpenEXR page.


drhein said...

Is there a way to export it out of photoshop and keep the displaywindow and datawindow info ?
I'd like to be able to export an image cropped and keep its datawindow the original size.

Brendan said...

drhein, there is actually, but it's a pretty hidden feature. In the ProEXR File Description, you'll see numbers for the dataWindow and displayWindow. As of a recent version, all the other attributes listed here will be put into the outgoing file, except for those two which would not longer be accurate if the user resized the document.

But if you really know what you're doing, you can rename them "dataWindowOverride" and "displayWindowOverride" and ProEXR will use them for the displayWindow and dataWindow. The dataWindowOverride will get checked first to make sure its size matches the size of your Photoshop document.

I know this extra step is kind of a pain, but I'm worried about people inadvertently transferring their original displayWindows downstream.

Dan Barker said...

Hi Brendan,

We use the OpenColorIO after effects plugin (which is fantastic) for 3d linear compositing workflows.

We recently noticed a "After Effects Warning: Unknown Exception." on opening a project

With some digging, we found the cause to be the OpenColorIO plugin. When removed from the plugins directory the project opens correctly (with the opencolorIO effect missing)

To complicate things, this is isn't happening on our master grading suite where this plugin is primarily used, but occurs on 2 other machines in the studio with the latest version installed (OpenColorIO_AE_v1.1.0_win)

Has anyone experienced this before, and know of a solution?

Many thanks