Return-Path: <tiff-bounces@lists.maptools.org>
Delivered-To: info@awaresystems.be
Received: (qmail 18255 invoked from network); 1 Oct 2008 19:04:03 -0000
Received: from janet.telenet-ops.be ([195.130.136.6])
          (envelope-sender <tiff-bounces@lists.maptools.org>)
          by angelia.telenet-ops.be (qmail-ldap-1.03) with SMTP
          for <info@awaresystems.be>; 1 Oct 2008 19:04:03 -0000
Received: from vijay.telenet-ops.be (vijay.telenet-ops.be [195.130.136.9])
	by janet.telenet-ops.be (8.13.1/8.13.1) with ESMTP id m91J41Rs002861
	for <info@awaresystems.be>; Wed, 1 Oct 2008 21:04:02 +0200
Received: from pierre.telenet-ops.be (pierre.telenet-ops.be [195.130.132.34])
	by vijay.telenet-ops.be (Postfix) with ESMTP id B774860003
	for <info@awaresystems.be>; Wed,  1 Oct 2008 21:04:02 +0200 (CEST)
Received: from apate.telenet-ops.be ([195.130.132.43])
	by pierre.telenet-ops.be with bizsmtp
	id MX421a00a0wL6ob01X42ri; Wed, 01 Oct 2008 21:04:02 +0200
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153])
	by apate.telenet-ops.be (Postfix) with ESMTP id 2DA4627EC54
	for <info@awaresystems.be>; Wed,  1 Oct 2008 21:04:02 +0200 (CEST)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m91Ixon4008513;
	Wed, 1 Oct 2008 15:01:58 -0400
Received: from grenfell.avtechpulse.com (grenfell.avtechpulse.com
	[64.26.155.62])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m91IxkcE008509
	for <tiff@lists.maptools.org>; Wed, 1 Oct 2008 14:59:46 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by grenfell.avtechpulse.com (Postfix) with ESMTP id E6E5712F8036;
	Wed,  1 Oct 2008 14:59:45 -0400 (EDT)
X-Virus-Scanned: amavisd-new at avtechpulse.com
Received: from grenfell.avtechpulse.com ([127.0.0.1])
	by localhost (server2.domain.avtechpulse.com [127.0.0.1]) (amavisd-new,
	port 10024)
	with ESMTP id 0UZ7N0MS73Lq; Wed,  1 Oct 2008 14:59:43 -0400 (EDT)
Received: from [192.168.0.80] (xena.domain.avtechpulse.com [192.168.0.80])
	by grenfell.avtechpulse.com (Postfix) with ESMTP id 1A52812F802D;
	Wed,  1 Oct 2008 14:59:43 -0400 (EDT)
Message-ID: <48E3C89E.9060308@avtechpulse.com>
Date: Wed, 01 Oct 2008 14:59:42 -0400
From: "Dr. Michael J. Chudobiak" <mjc@avtechpulse.com>
Organization: Avtech Electrosystems Ltd.
User-Agent: Thunderbird 2.0.0.16 (X11/20080723)
MIME-Version: 1.0
To: Richard Nolde <nrichard8@qwest.net>
Subject: Re: [Tiff] Image Orientation tag and rotating images
References: <200809281220.m8SCKUdx016387@duke.maptools.org>
	<48E2E87D.3@qwest.net> <48E36F4B.8030405@avtechpulse.com>
	<48E3A616.7040100@qwest.net>
In-Reply-To: <48E3A616.7040100@qwest.net>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: tiff@lists.maptools.org
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-SpamCatcher-Score: 50 [XX]

>> 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
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
