openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openexr-devel] usage of displayWindow produces invalid files


From: Vincent Olivier
Subject: Re: [Openexr-devel] usage of displayWindow produces invalid files
Date: Mon, 17 Mar 2014 17:05:25 -0400

Thanks for your reply!

I adapted the example from the display window documentation in the Technical Introduction to soft-crop a 4K-FULL (4096x2160px) to a vertically centred 4K-SCOPE (4096x1716px). From what I now understand, the display window should be:

(0,222) — (4095, 1715)

and the data window should be:

(0,0) — (4095, 2159)

With this code:

Box2i dataWindow (V2i (0, 0), V2i (width - 1, height - 1));
Box2i displayWindow (V2i (0, displayHeightOffset), V2i (width - 1, displayHeight - 1));

Everything looks fine with exrheader, photoshop and Mac OS X Mavericks preview. But it crashes Nuke utterly.

Or I could offset negatively the data window (like you suggested) with:

(0,-222) — (4095, 1937)

and the display window should be:

(0,0) — (4095, 1715)

This works everywhere. But then, I get a black band on top of the (full) image and I’m losing data. Should I offset negatively the “pixels” Rgba array? How can an array have a negative offset?


On Mar 17, 2014, at 4:03 PM, Peter Hillman <address@hidden> wrote:

Seems like you aren't writing enough rows - shouldn't you be writing (height + displayHeightOffset) rows of data in the second case?
Or perhaps you mean to say dataWindow (V2i (0, 0 - displayHeightOffset), V2i (width - 1, height - 1 - displayHeightOffset));


On 18/03/14 08:48, Vincent Olivier wrote:
Hello,

This is probably very trivial, but I can seem to find a solution. This code works:

Header header (width, height);
RgbaOutputFile file(fileName, header, WRITE_RGB);
file.setFrameBuffer(pixels, 1, width);
file.writePixels(height);

This code doesn’t:

float DCI_SCOPE_RATIO = 858.0 / 1080.0;
int displayHeight = round(height * DCI_SCOPE_RATIO);
int displayHeightOffset = (height - displayHeight) / 2;
Box2i dataWindow (V2i (0, 0 - displayHeightOffset), V2i (width - 1, height - 1));
Box2i displayWindow (V2i (0, 0), V2i (width - 1, displayHeight - 1));
Header header (displayWindow, dataWindow);
RgbaOutputFile file(fileName, header, WRITE_RGB);
file.setFrameBuffer(pixels, 1, width);
file.writePixels(height);

It compiles and all, but it writes corrupted OpenEXR files that are unreadable and that exrheader reports as being “incomplete”. Is there an obvious problem somewhere?

Thanks!

Vincent


_______________________________________________
Openexr-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/openexr-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]