For some common image formats, the supported orientation (view perspective) values are either TOP_LEFT or BOTTOM_LEFT.
For example, Windows BMP files are usually stored as BOTTOM_LEFT (top-most line of pixels is stored LAST in the file) while PNG files are TOP_LEFT (top-most line of pixels is stored FIRST in the file).
However, some image file formats such as TIFF and EXIF support storing other orientation values, which means the image can be rotated in any direction.
Common sources of such files are cameras that contain gravity sensors which detect how the camera itself is rotated during taking the photo. Such cameras might always store the pixel data the same way regardless of how the camera is rotated, but they would indicate the camera, and thus the taken photo, are rotated by storing a metadata tag value to indicate orientation.
A sample rotated image is attached with this post. If you see the cannon displayed correctly upright, this means your viewer correctly reads the orientation tag and modifies the display accordingly.
If you see the cannon rotated to the left, this means your viewer is displaying the data as is, because the image data is actually rotated to the left. However, the orientation tag says the image has TOP_LEFT90 view perspective, which means the viewer should rotate it 90 degrees clockwise before displaying it.
What does this mean for your LEADTOOLS application?
- Option 1: Leave it to the default setting.
By default, LEADTOOLS will correctly load and display the images according to the stored orientation tag in the file. This means you simply load the image and don't worry about its view perspective.
- Option 2: Force the toolkit to disregard the Orientation tag.
Some applications require compatibility with older viewers that did not correctly interpret the view perspective values. If your application has this requirement, you can make it behave like these older viewers by setting the ELO_IGNOREVIEWPERSPECTIVE flag (C DLL and C++ ClassLib) or the RasterCodecs.Options.Tiff.Load.IgnoreViewPerspective (.NET) to true before loading the image.
- Option 3: Customize your own behavior.
If you want to neither respect the Orientation tag nor totally ignore it, you can do whatever type of rotation handling you like using our toolkit. First, get the file's view perspective value before loading it by using our FileInfo function to determine how you want it rotated. Then load the file and rotate it using the Rotate function. For more details read this forum thread:
https://www.leadtools.com/support/forum/posts/m2789-JPEG---width---height-reversed---Lead-14#post2789Edited by moderator Tuesday, March 28, 2017 1:57:41 PM(UTC)
| Reason: Not specified
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.