This is a followup to a question at Apple.stackexchange.com, Why does rotating a TIFF in Preview increase the file size?

One thing I don't like about Preview.app is that even something as simple as rotating an image 90 degrees requires Preview to re-encode the file, adding an alpha channel in the process. This results in a file that is 10% to 20% larger than the original, with no added benefit. This size difference may not matter much on a 5 MB file, but on a 500 MB file, it is a nuisance.

(Interestingly, Preview.app does not increase the file size if you rotate a PDF.)

I gave GraphicConverter 10 a shot. All I did was rotate the TIFF and save, and the file size increased about 60%—it's even worse than Preview.

I tried IrfanView on Windows and it also increased the file size about 60%.

Are there any applications that can rotate a TIFF image 90 degrees without re-encoding it and altering the image in any other way? The source of the TIFF is a scanner, which does not offer a rotation feature.

I did a search and all I found were JPEG programs.

(2013 rMBP) -- (OS X 10.11.4) -- (I am open to Windows programs, too.)

  • 1
  • Which site does this type of question belong? I thought that maybe it fits better in Photography. – Kyle May 28 '16 at 3:43
  • 2
    Post-processing images, and use of post-processing software, is certainly on-topic here at Photo.SE, but I'd argue that your use, generally just scanning and straightening (or rotating 90°) is more suited to Apple.SE. Your question seems to imply a more general use case than being photography oriented. – scottbb May 28 '16 at 3:45
  • Is there a reason you didn't post this as a follow-up question over at Apple.SE? – scottbb May 28 '16 at 3:49
  • 2
    One last comment - personally, I think this question belongs on softwarerecs.stackexchange.com – osullic May 28 '16 at 9:15

It is possible and even trivial but I am not aware of any application to do that task specifically.

There reason why the file size changes when rotated is that TIFF files are encoded losslessly as one would compress a stream of pixels components from one corner of the image to the opposite one. If you consider Run-Length-Encoding (RLE) which a common TIFF encoding, it is easy to understand why the same image will not compress to the same size after being rotated. It is equally likely that the file increases in size than it would decrease.

There is an easy way to get around that though and that is simply to change the tag which says which way pixels are ordered in the image. By simply changing the tag from a row-oriented ordering to the equivalent column-oriented one, the image is effectively rotated without any change to pixel data. You can read the details about the TIFF format here, just search for tag 274 (Orientation).

Honestly I thought no one used column oriented storage pixels so when I initially wrote a TIFF codec, I ignored that possibility for simplicity. As it would happen, one day we received such a TIFF image and my code did crash! Hopefully not many other developers took that short-cut either. It turns out that the file in question came from a scanner which did the scanning and encoding always exactly in the same way but set the orientation flag depending if it was fed a film-strip with frames in landscape or portrait orientation.

  • Hi Itai, is there a TIFF metadata editor that you particularly recommend? – Kyle May 28 '16 at 19:58
  • Sorry, I haven't used one for a while. TIFF is loosing some popularity it seems, although it is the basis for DNG, so maybe some tools can operate on either. – Itai May 29 '16 at 4:15
  • If you download ExifTool, rotation can be completed in Terminal: exiftool -n -orientation=8 [file path here] – Kyle May 31 '16 at 2:39

I wasn't matching the compression type before, which at least partially resulted in a larger file size. In case someone comes across this question and is curious, here are the results of a shoot-out of various programs, rotating a 21.3 MB TIFF file 90° counterclockwise, matching for compression type (LZW) and byte order (big-endian) (if given the option):

XnView MP: 30.4 MB

GraphicsConverter: 30.2 MB

Preview.app: 25.0 MB

IrfanView (Windows only): 22.2 MB

Xee: 22.070 MB

ToyViewer: 22.067 MB

The only one of these programs that adds an alpha channel to the file is Preview.

I still don't know why the file size increases, and never decreases or stays the same, but ToyViewer is the program that adds the least to the file size. ToyViewer is also free.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.