Warning: TIFF files can flip your images!

What do I mean by "flip"? An image such as this represents a right hand. If we "flip" the image on a vertical axis, we arrive at a left hand: . Notice that if you "flip" the three dimensional object, it would be a 180 degree rotation and the handedness would not change. If you "flip" a two dimensional paper image it means to turn the paper over and run the ink to the other side of the paper. In that case the handedness will change if the object is chiral. For example, rotating a 3D shoe 180 degrees will not change the handedness, but turning an image of a shoe over (as on a transparency) would change the handedness depicted.

Robert Coontz, Deputy News Editor of Science magazine, reports that sometimes when one compresses TIFF files and expands them, they will come out as mirror images.

This caused one of the Left Handed DNA cases reported in 2000.

Here is what he wrote to Irwin Tessman:


Date: Fri, 28 Jul 2000 15:32:31 -0400
From: "Robert Coontz" <rcoontz@aaas.org>
To: <itessman@purdue.edu>
Subject: Left-handed DNA in "Science" magazine

Professor Tessman,

This is Robert Coontz, deputy news editor at "Science." Thanks for
pointing out the [left-handed] DNA in the July 14 issue. Your keen eye
helped us to track down a software glitch that could have caused the
magazine even greater embarrassment later on.

The image file that we used on pages 208 and 235 came from Floyd Romesberg's
lab at Scripps, which sent it to "Science" as an e-mail attachment.  Our art
department swore that they had not flipped the image in any way; people in
the lab at Scripps, meanwhile, swore that the DNA was righthanded when they
sent it. Finally, the postdoc who created the image of the space-filling
model shed some light on the situation. "Oh," she laughed, "that happens
sometimes with TIFF files. When you compress them and then expand them again
to view them, sometimes they come out as mirror images."

The reason seems to be that one popular algorithm for compressing TIFF files
stores bytes in a different order from other formats. Evidently some
file-viewing routines don't correct for the different order and interpret the
backwards bytes as a flipped image. I'll let our art department worry about
the details. Meanwhile, we are running a correction on the letters page of
the August 4 issue and in the future will look very carefully at any
decompressed TIFF files that come our way.

Many thanks,

Robert Coontz

Robert Coontz 
Deputy News Editor
"Science" magazine
1200 New York Avenue, NW
Washington, DC  20005
phone 202-326-6527
fax 202-371-9227

The letter is reproduced with permission.


2001 Jan 5. Alex Kekesi (Alex.Kekesi@gsfc.nasa.gov) of the Scientific Visualization Studio NASA Goddard Space Flight Center told me what they thought may be happening: The tif format allows for user defined tags. These tags can be observed or ignored. Some tif file writers add a tag to tell which way up is, but some readers ignore it. So if one program writes the tag and the other ignores it, the image would be flipped.

This is apparently correct. The book, "Graphics File Formats", David C. Kay and John R. Levine, (2nd edition, Windcrest/McGraw-Hill, NY, 1995, ISBN 0-07-034025-0) has the entire chapter 6 devoted to TIFF format. On page 77 it describes the Oritentation tag which defines where the scan lines of an image run. Although Orientation is required for all TIFF readers, baseline TIFF readers are only required to support the default orientation code "1". This means that if your reader is not sophisticated, it will flip the image! The implication is that if you find that your image is being flipped, you can go to the software source and get an upgrade or get a better reader. The implication is also that the problem has nothing to do with image compression/uncompression.

The simplest solution is to always use GIF or JPEG files when sending images.


If you can reproduce this effect on your computer system (apparently you may need to use a different TIFF reader from your TIFF writer), please send me a note describing the operating system and the software you used, including version numbers. I will report the information here. Please indicate whether I may cite your name and email address.

Tom Schneider
origin: 2000 December 27
updated: 2013 Apr 30