You are here: Appendix A - Technical Notes > Negative y-Resolutions

Negative y-Resolutions

The y-resolution ("YRES" or "YDIM") of an image can be either positive or negative, depending on what type of image is being used and which interface is being used to query the resolution. This note provides some background on this issue.

First, some definitions:

By "negative YDIM" (hereafter, "-YDIM"), we mean that (0,0) is in the LOWER LEFT and extends up and to the right to (w,h). This is the normal Cartesian representation you learned in high school algebra.

By “positive YDIM” ("+YDIM"), we mean that (0,0) is in the UPPER LEFT and extends down and to the right to (w,h). This is a common representation in computer graphics.

Figure 1 shows the default geo coordinates for a 640x480 image with no internal georeferencing, using -YDIM conventions. Note that while the rows of the image will proceed visually down the page, the y-value of the rows decreases, from 479 down to 0.

Figure 1:  640w x 480h

The MrSID SDK follows the -YDIM convention. This means that the function LTIGeoCoord::getYRes() will generally return a value less than zero. Image reader and writer classes must respect this: when importing or exporting geospatial resolutions, care must be taken to adjust the sign if needed in order to match the SDK requirements and the external file format requirements.

Additional notes

The classical MrSID metadata tag IMAGE::Y_RESOLUTION is stored with a positive sign, for historical reasons. If you access this metadata value directly, you must multiply the value by -1.0 before using it.

As a debugging aid, the mrsidinfo tool can be used to show the georeferencing of the image, including all four corner points.

World files expect the use of negative YDIMs (fourth line).

BBB files use positive YDIMs in their headers. (The LTIBBBImageReader class will internally negate the value to satisfy the SDK requirements.)

YDIM and XDIM should never be 0.0.