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 <pet...@wetafx.co.nz> 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
>> Openexr-devel@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/openexr-devel
> 

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

Reply via email to