# Rotating images in Windows



## iskoos (Mar 14, 2010)

Whenever I try to rotate my images (from landscape to portrait) with window's picture and fax review program, it gives me a warning saying that rotating the image may permanently effect its quality.

Lately I am not doing it anymore because Canon's ZoomBrowser automatically show the images in portrait mode without rotating it but the question in my mind remains: Would the image quality be really effected if I rotate images with window's picture and fax viewer program?


----------



## Josh66 (Mar 14, 2010)

I haven't noticed any difference.

I usually do all of that in Lightroom - but occasionally I'll just right-click it in it's folder and rotate that way.

I've never had any warnings pop up though...


----------



## Dwig (Mar 14, 2010)

iskoos said:


> ... Would the image quality be really effected if I rotate images with window's picture and fax viewer program?



Yes. How much depends on the JPEG's quanlity setting.

As I understand it, neither Windows Preview or Windows Picture & Fax Viewer can edit the JPEGs EXIF data to alter any orientation flag. The rotate the image by rewriting the actual image data. This requires that the JPEG data be recreated. Since JPEG uses a lossy compression as part of its structure any regeneration of the JPEG will cause some loss in quality.

I generally avoid rotating JPEGs in these viewers. If the original JPEG's quality setting is high the loss can be minimal, but it is still present.


----------



## Proteus617 (Mar 14, 2010)

Rotations of other than 90 deg (or 180 or 270) are always destructive.  90 deg rotations can be loss-less, depending on file type and sophistication of the algorithm used.  Rotating a JPG with windows viewer is lossy.  You will most likely never notice the difference.


----------



## iskoos (Mar 14, 2010)

Yes, I am sure the loss will be minimal and I will never notice it. But the fact that I will lose something is enough for me to avoid using windows' internal program to rotate my images. I am still rotate some unimportant images but I will not do this for images that are important to me...

P.S. Windows will not warn you if you click on "Do not show this warning again." message once. This is probably what happened to those who don't see this warning message.


----------



## Josh66 (Mar 14, 2010)

I'm not sure if I have ever checked the 'do not show me again' box or not...

It is rare that I rotate images outside of Lightroom.  Usually, they are not my pictures (pictures from relatives who need to use my computer for whatever reason).  I only shoot RAW, and all RAWs get rotated in LR, if required.


----------



## airtas (Mar 14, 2010)

I was actually wondering this today........I was playing around and of course made copies but some images Windows gave me a warning and others it did not.


When I would rotate an image the file size went to 1.98 from 1.99

But when I rotated back it went back to 1.99 mb

Does that make sense?


----------



## Garbz (Mar 15, 2010)

Basically yes. Every time you use a lossy compression you throw away more of the data. Even with identical settings selected by the use each program has a LOT of options selected by the programmer to create a JPEG file. This means that Saving a Quality 12 file in Photoshop will not be the same as setting a 100% quality image in ACDSee, not to mention that the option of selecting even something as basic as quality is not even given in windows picture and fax viewer. 

In that respect, opening an image in Photoshop and then saving it again will have the same effect but at least you are somewhat in control given the quality slider. The less voodoo in your workflow the better.



Proteus617 said:


> Rotations of other than 90 deg (or 180 or 270) are always destructive.  90 deg rotations can be loss-less, depending on file type and sophistication of the algorithm used.  Rotating a JPG with windows viewer is lossy.  You will most likely never notice the difference.



To extend: rotating a JPEG in any program is lossy.



iskoos said:


> Yes, I am sure the loss will be minimal and I will never notice it.



I used to think the same thing. Then I did a quick test. Wrote a script that would open an image save the image, and close the image, rinse repeat for 100 times. JPEG quality was cranked to maximum for the entire time. After a surprisingly small number of saves (5 or so) a significant quality drop was notable. After 10-20 (can't remember the number exactly) the image became outright corrupted. 

Pretty strange for the same algorithm doing the same thing over and over again. 



airtas said:


> When I would rotate an image the file size went to 1.98 from 1.99
> 
> But when I rotated back it went back to 1.99 mb
> 
> Does that make sense?



I assume you mean it went back to 1.98mb. Yes it makes sense. Most algorithms are not directionally agnostic. e.g. a horizontal gradient may compress differently than a vertical gradient. JPEG divides the images into rectangular chunks. The mere act of rotating an image will mean each chunk is occupied by different data.


----------



## airtas (Mar 21, 2010)

wouldn't the file size shrink though if there is less info in the file?

I though some programs did lossless rotation


----------



## Garbz (Mar 22, 2010)

No. The file size is determined entire by the JPEG settings. You can save an image as a horrible quality 1 JPEG that is tiny, but if you then open it and save it as a quality 12 JPEG again the file size will be huge again despite the original information lost.

The loss is not introduced in the rotation but in the re-saving. If you open a TIFF file and rotate it in Picture and Fax Viewer it would be lossless too. The other option is simply modifying the rotational bit in the ExIF data. This too is lossless, but it does not result in a re-write of the data. Instead software which is aware of the data will open it and rotate it straight away.

Example. JPEGs recorded by my camera vertically will have this bit set. If I open the file in an old copy of Picture viewer it will be horizontal. If I open it in Photoshop then the file will be displayed vertical. However if I then click file -> save as and save the file without making any changes to it, the old Picture viewer will see it vertically since photoshop will save it as it sees it. If I do this and save as a TIFF then the rotation was in effect lossless.


----------



## airtas (Mar 28, 2010)

so windows picture and fax viewer is always bad? not only when it just shows you the warning?


----------



## KmH (Mar 28, 2010)

airtas said:


> so windows picture and fax viewer is always bad? not only when it just shows you the warning?


No, JPEG is bad because being a lossey format it discards some measure of image data each time it is saved, no matter what software you use to do the save.


----------



## table1349 (Mar 28, 2010)

iskoos said:


> Whenever I try to rotate my images (from landscape to portrait) with window's picture and fax review program, it gives me a warning saying that rotating the image may permanently effect its quality.
> 
> Lately I am not doing it anymore because Canon's ZoomBrowser automatically show the images in portrait mode without rotating it but the question in my mind remains: Would the image quality be really effected if I rotate images with window's picture and fax viewer program?



Download this.  It's freeware.


----------



## Garbz (Mar 29, 2010)

Windows picture and fax viewer is bad when you use it to rotate an image in a lossy format like JPEG.


----------



## airtas (Mar 31, 2010)

what is you rotate an image that is using meta data flags?


----------



## Garbz (Apr 1, 2010)

Do you mean how, or what programs? There are a lot of programs out there that recognise the rotate flag in ExIF. ACDSee, Photoshop, Picasa just to name a few.

If you mean how, your camera sets a flag in the image to rotate it clockwise or counterclockwise, but saves the image in the standard landscape orientation. Software then should read and adjust when opening.


----------



## Lipoly (Jul 11, 2010)

(Post resurrection alert)

FYI: I just did a test in Windows 7, opening an image and rotating it 45 deg 16 times and then used Beyond Compare to compare with the original and they were identical (in addition to them having the same file size).  I also did a 400% zoom side-by-side comparison and say no differences.

It looks like win 7 uses meta data to do rotations in the built-in picture viewer.


----------



## Garbz (Jul 12, 2010)

Lipoly said:


> (Post resurrection alert)
> 
> FYI: I just did a test in Windows 7, opening an image and rotating it 45 deg 16 times and then used Beyond Compare to compare with the original and they were identical (in addition to them having the same file size).  I also did a 400% zoom side-by-side comparison and say no differences.
> 
> It looks like win 7 uses meta data to do rotations in the built-in picture viewer.



False test. The biggest difference between Windows 7 picture viewer and the earlier versions is that the file is only saved when Windows picture viewer is closed.

Quick test open a file and rotate it once clockwise, and then close it again. My original was 0.97MB with ExIF orientation data "Upper Left". After I rotated it clockwise and closed Windows 7 picture viewer the result is a file that is 330KB with ExIF orientation data still "Upper Left", and now the ExIF resolution disagrees with the actual file resolution too since that wasn't re-written.

So Windows 7 Picture Viewer only sucks a little less than it's predecessor, but what is quite good is that it is output colour managed and will recognise not only the working colour space of the image, but also the output space of the monitor.


----------



## Lipoly (Jul 12, 2010)

I closed it after every rotation...I'm not seeing what you are seeing.  There was no change in the picture after 16 rotations (closing and re-saving after each).


----------



## Garbz (Jul 13, 2010)

Sure you're working with JPEGs?
Also try right clicking on an image and clicking "rotate clockwise" and see if the result is the same.
One more thing you can do to confirm what's going on is check the ExIF data. See if the orientation flag changes. 

I just tried something else to see if another suspicion of mine was right and copied the image, rotated it once, then made another copy of it and rotated it 4 more times to see if the act of a complete rotation after a single window rotation produces the same file as just the single rotation. Result is nope:

Original: 955KB
1 CW rotation: 288KB
3 further CW rotations: 286KB

The JPEG algorithm also doesn't allow for reproducing the original file. It's simply not possible to open a JPEG and save it and have the data come out exactly as the original did. Even photoshop if you repeat this about 20 times you start getting severe image corruption. (edit apparently some clever algorithms can, photoshop does not use this).

Either your software is doing something strange (not saving) or your computer is magic


----------



## Lipoly (Jul 13, 2010)

Yes, I'm working w/JPEGs.

I did some more testing.  

1. I took an old photo from a 2.1MP Olympus camera (619KB original).  After about 10 rotation/saves, it had obvious artifacting.

2. Took a pic from my D5000 (4433KB) and rotated it 32 times (4426KB) and could see zero difference in the photos...absolutely no artifacting, and no loss of detail.  I studied each side-by-side at extreme zoom...no noticeable difference.

So, I'm wrong about Win7 using exif data.  But, is there a chance that JPEG "fine" is lossless?  I'm thinking no, but can't explain what I'm seeing.  

It does seem that JPEG can be rotated in 90deg increments (and cropped) w/o re-encoding the image and w/o using EXIF : http://en.wikipedia.org/wiki/JPEG#Lossless_editinghttp://en.wikipedia.org/wiki/JPEG#Lossless_editing...maybe maybe that is what is going on (doesn't explain why one degrades, while another doesn't).


----------



## Garbz (Jul 15, 2010)

Even if it were lossless the JPEG data would be different so your file comparing would have shown it. Also you said the size changed after you rotated it.

Can you do me a favour, open your D5000 image in a different app and save it with the best compression you can, quality 12 in photoshop if you have it. Then note the filesize before and after rotation? 

Actually with the new version of photoshop out it's worth re-visiting the test to see if pohtoshop will still corrupt the image after multiple re-saves. I did that on CS2 as far as I remember.


----------

