AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2008.09.23 23:34 "[Tiff] TIFF Image Quality Question", by Rick Cone, Secure Payment Systems
2008.09.24 00:11 "Re: [Tiff] TIFF Image Quality Question", by Bob Friesenhahn
2008.10.01 23:18 "Re: [Tiff] Image Orientation tag and rotating images", by Richard Nolde
2008.10.01 03:03 "[Tiff] Image Orientation tag and rotating images", by Richard Nolde
2008.10.01 12:38 "Re: [Tiff] Image Orientation tag and rotating images", by Dr. Michael J. Chudobiak
2008.10.01 14:25 "Re: [Tiff] Image Orientation tag and rotating images", by Richard Nolde
2008.10.01 16:32 "Re: [Tiff] Image Orientation tag and rotating images", by Richard Nolde
2008.10.01 18:59 "Re: [Tiff] Image Orientation tag and rotating images", by Dr. Michael J. Chudobiak
2008.10.02 05:43 "Re: [Tiff] Image Orientation tag and rotating images", by Andrey Kiselev
2008.10.01 15:08 "Re: [Tiff] Image Orientation tag and rotating images", by Bob Friesenhahn
2008.10.01 16:02 "Re: [Tiff] Image Orientation tag and rotating images", by Edward Lam
2008.10.02 02:42 "Re: [Tiff] Image Orientation tag and rotating images", by Bob Friesenhahn
2008.09.24 01:14 "Re: [Tiff] TIFF Image Quality Question", by Phillip Crews

2008.10.01 18:59 "Re: [Tiff] Image Orientation tag and rotating images", by Dr. Michael J. Chudobiak

  1. libtiff support for orientation is a little odd, because libtiff automatically adjusts for orientations 1-4 (which preserve the height and width), but not 5-8 (which swap height and width). Beware!

What file are you referring to when you say that libtiff automatically adjusts for orientations 1- 4? I should have noted that I am using the TIFFReadScanline and TIFFReadTile interfaces, not the TIFFReadRGBAImage interface as found in tif_getimage.c.

The above comments applied to TIFFReadRGBAImage, so you don't need to worry about that. But it's still good to know...

3) If you transform the data to reflect the orientation tag, the orientation tag should be reset to "top left", or be removed entirely.

However, in my case, I am not transforming the data to reflect the orientation tag, rather as a specific request to rotate the image by a multiple of 90 degrees. This leaves open the possibility that images that did not have an orientation of TOPLEFT originally will still not display properly in some applications since the code above does not handle all orientations. It forces the orientation tag to a left-handed, top or bottom, value.

In gthumb, we set it up so that you can rotate by:

1) changing the orientation tag only

or

2) by physically transforming the data and resetting the tag to top-left

In BOTH cases, we take into account the original orientation tag value.

We avoid physically transforming the data and having a non-top-left output orientation tag. I guess you could do that if you wanted to, but I wouldn't personally recommend it.

Officially, the EXIF standard does require you to reset the orientation tag to top-left after a rotation.

One final question about what the proper behavior should be since this is not a display application. Should the data be transformed to ORIENTATION_TOPLEFT when an image with any other orientation is loaded into memory under the assumption that this is the correct viewing orientation? Any requested rotations would then be made relative to the adjusted viewing orientation rather than to the original orientation. Or should rotations be relative to the original image orientation without regard to the proper viewing orientation. This is what I am doing now. In either case, it seems like resetting the orientation to TOPLEFT is appropriate when the data are transformed.

In gthumb, we load the data, transform it based on the orientation tag, and apply any requested operations (crop, rotate, whatever) based on the transformed data. In other words, we always honor the orientation tag, assuming that if the user didn't mean it, it wouldn't be in the file.

- Mike