Exr images with data window don't get rendered properly

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
shibata
Posts: 3
Joined: 2014-01-09T05:48:15-07:00
Authentication code: 6789

Exr images with data window don't get rendered properly

Post by shibata »

Hi,
I've been playing around a bit with the exr libraries and tried creating an exr file with a data window < display window (the area with data is smaller than the image resolution). Using the sample code provided in the docs to read the image and saving it with:

Code: Select all

void writeRgba2 (const char fileName[], const Rgba *pixels, int width, int height, const Box2i &dataWindow) {
    Box2i displayWindow (V2i (0, 0), V2i (width - 1, height - 1));
    RgbaOutputFile file (fileName, displayWindow, dataWindow, WRITE_RGBA);
    file.setFrameBuffer (pixels, 1, width);
    file.writePixels (dataWindow.max.y - dataWindow.min.y + 1);
}
The generated image has a smaller data window and is displayed correctly with exrdisplay:

Original image
Image

Generated image
Image

But imagemagick stretches the end of the data window until the end of the image:
Image

The problem persists after converting the image to other formats (eg. convert test.exr test.png).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Exr images with data window don't get rendered properly

Post by fmw42 »

Are you using 32-bit EXR images or "half format" 16-bit EXR images. IM only supports the latter.
shibata
Posts: 3
Joined: 2014-01-09T05:48:15-07:00
Authentication code: 6789

Re: Exr images with data window don't get rendered properly

Post by shibata »

I was using 32-bit floats, but the issue happens with 16-bit halfs, too.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Exr images with data window don't get rendered properly

Post by fmw42 »

Looks like a -virtual-pixel edge effect. Try setting virtual-pixel to black or transparent and see how it looks.
shibata
Posts: 3
Joined: 2014-01-09T05:48:15-07:00
Authentication code: 6789

Re: Exr images with data window don't get rendered properly

Post by shibata »

Looks the same :(
Post Reply