oiiotool - what's the difference between origin and originoffset? #4826
-
I'm getting a little mixed up trying to think through what "origin" does. I think that in my application, originoffset is what I want, but I'm having trouble explaining the results I was seeing with "origin." When I convert to exr with vrimg2exr, I use the -dataWindow option and it basically autotrims the data window. After this step, I still have a 3078x1288 display window with the lower left corner being (0,0). And in this, it has a data window of (230, 506) - (2848, 1070). Then I tried to adjust the size of the display window, and have it centered on the original image and tried: and the result had the display window 2932x1228, but the data window became (-74, 695) - (2544, 1259). I don't understand what shift just happened with the data window. The -74 would make more sense to me if the y value was around -30 (though honestly I still don't quite understand that) But how it got the 506 -> 695 I really don't understand. Note that if I use --originoffset -73-30 (the same as I used above) instead of "origin", I get a data window of (157, 476) - (2775, 1040) which is correct, so I have my patch) But I still want to understand what is the "origin" calculation? and how did I get the data window that I did? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
OK, first, let's get some terminology straight. It can be a little tricky, because OIIO is meant to handle many different file formats, so some of its terminology doesn't necessarily match the OpenEXR-specific terminology. OpenEXR has the data window, the area with stored pixel values (everything outside of which is assumed 0-valued/black), and the display window, the part that is the nominally displayable image boundary, independent of where pixel values are stored in the file. Both of these are rectangles defined by their upper left (low values) and lower right (high values) coordinates, and are "inclusive end" (the lower right extent has a value, it's not one past the valued region, if you know what I mean). The exr "data window" is defined by what OIIO calls the image origin (the ImageSpec.x, .y) and image size or resolution, defined by ImageSpec.width, .height. The exr "display window" is what OIIO calls the "full" origin and size: ImageSpec.full_x, full_y, full_width, full_height. oiiotool has several commands that modify these in different ways:
Also, these oiiotool commands use a compact notation that looks like 1024x768+100+200, to mean a size of width=1024, height=768, and an origin x=100, y=200. Some commands only need the resolution part and some only need the origin part, and some can take both. (Trivia: this notation originated with X-Windows' "geometry" notation for window size and placement.) Is that enough to answer all your questions? Let me know if we need to walk through your commands to figure out how to put your image in a particular place. |
Beta Was this translation helpful? Give feedback.
OK, first, let's get some terminology straight. It can be a little tricky, because OIIO is meant to handle many different file formats, so some of its terminology doesn't necessarily match the OpenEXR-specific terminology.
OpenEXR has the data window, the area with stored pixel values (everything outside of which is assumed 0-valued/black), and the display window, the part that is the nominally displayable image boundary, independent of where pixel values are stored in the file. Both of these are rectangles defined by their upper left (low values) and lower right (high values) coordinates, and are "inclusive end" (the lower right extent has a value, it's not one past the valued region, if…