Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas004.isp.belgacom.be (localhost [127.0.0.1])
        by inav028.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AV-3.00) with ESMTP id k49M6t7M013346
        for <joris.at.lebbeke@skynet.be>; Wed, 10 May 2006 00:06:55 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx009.isp.belgacom.be (inmx009.isp.belgacom.be [195.238.5.146])
        by inas004.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AS-2.03) with ESMTP id k49M6njd028837
        for <joris.at.lebbeke@skynet.be>; Wed, 10 May 2006 00:06:49 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx009.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-2.32) with ESMTP id k49M6feY029861
        for <joris.at.lebbeke@skynet.be>; Wed, 10 May 2006 00:06:42 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
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 k49Lu4DZ007724;
	Tue, 9 May 2006 17:57:14 -0400
Received: from corpdallcn01a.srcp.dmz (us.srcp.com [208.65.4.7])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k49Lu1CW007721
	for <tiff@lists.maptools.org>; Tue, 9 May 2006 17:56:02 -0400
Received: from CORPDALLMSG05.na.srcp.net ([10.150.10.111] RDNS failed) by
	mail.srcp.com with Microsoft SMTPSVC(6.0.3790.211); 
	Tue, 9 May 2006 16:55:54 -0500
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Date: Tue, 9 May 2006 16:55:51 -0500
Message-ID: <741E24F735AED141B61948AC155E7DAA9B0CB1@CORPDALLMSG05.na.srcp.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: TIFF Rotation
Thread-Index: AcZzs1aTMEGIzmFNQUG4TFHa7nwksA==
From: "Frank, Jason" <JasonFrank@srcp.com>
To: <tiff@lists.maptools.org>
X-OriginalArrivalTime: 09 May 2006 21:55:54.0401 (UTC)
	FILETIME=[5846C110:01C673B3]
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by duke.maptools.org id
	k49Lu1CW007721
Subject: [Tiff] TIFF Rotation
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-UIDL: 000000000023ceae.00001670
X-MSP-STORE: Wed, 10 May 2006 00:07:03 --21-99
Status:   


Well, I've tried to dodge this, but I don't see another option.  I need
to be able to rotate TIF's by 90, 180, or 270 degrees.  Near as I can
tell, there's not really any support for this in libtiff, and I don't
want to pay the ImageMagick penalty for bi-tonal images.  To be honest,
performance is not a huge concern, since it will be done rarely at best.
But, I can't afford ImageMagick's memory usage.  Although I can probably
accommodate a single uncompressed directory.  So I guess I need to roll
my own.

So far, I haven't found any code that does an honest to god image
rotation in libtiff.  I've found a couple programs that monkey with the
orientation tag, but that's not usually a good approach, since not
everyone supports the orientation flag correctly.  If anyone knows of
any other source code, I'm happy to use that instead.

What I'm trying to decide on is how to best do it, both from an
algorithm perspective, and from a code organization perspective.

The first question is should this be a distinct program, an option for
tiffcp, or both?

The second is that I'm willing to bet that a lot of the contents of
tiffcp.c are going to be useful, especially the algorithms to convert
tiles to strips and back.  After all, the programs are going to be doing
very similar work.  That's because I envision my program converting to
strips, uncompressing the data, iterating through the strips and putting
things where they should be.  Finally, it would put things back in tiles
as necessary.  But, since these are in tiffcp.c, they're not really
accessible to other programs.  How does everyone feel about moving a
significant portion of the tiffcp.c contents into the libtiff library?
Which functions and how exactly to do it are obviously up for debate...

How about a library function to reorient a TIF *?  Then, if you need to
mirror an image horizonally, you just change the orientation's X
component (e.g. TOPLEFT to TOPRIGHT), to mirror vertically, you change
the orientation's Y component (e.g. TOPLEFT TO BOTTOMLEFT). If you need
a 180 degree rotation, I think you can just pick the opposite corner
(e.g. TOPLEFT to BOTTOMRIGHT)  Then, you would simply reorient it back
to the original orientation.  I would pretty much expect this function
to leave everything else undisturbed (strips vs. tile, compression,
etc.)  Heck, I'd probably provide a mirrorhorizontal, mirrorvertical and
rotate180 function to even do that work for us, but that's a design
issue.

That would give me 1/3 of the functionality that I need, and provide
some other useful functionality also.

I don't thing that works for a 90 or 270 degree rotation though.  I
think I have to actually march the strips and fill rows out as columns.

Anyway, I'm very happy to listen to suggestions on this.

Jason



<font size="1" face="arial">This message (including any attachments) may contain confidential or otherwise privileged information and is intended only for the individual(s) to which it is addressed. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message or that arise as a result of e-mail transmission. If verification is required please request a hard-copy version from the sender.

SOURCECORP, Incorporated
www.srcp.com
</font>

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
