Are "Windows Photo Viewer" rotations lossless?

by user5306   Last Updated October 10, 2019 12:18 PM

Can I rotate lossily compressed photos that I view in Windows Photo Viewer without worrying about losing even more information to compression?

Answers 1

If the dimensions of the image are multiples of 8 (or 16 if chroma subsampling is used) then the rotations are lossless. Otherwise it is not possible to rotate the image without recomputing the blocks i.e. recompressing the image, which is lossy.

The reason for this is that jpeg images are broken up into a series of 8x8 or 16x16 blocks which are compressed individually. Incomplete blocks are only allowed on the right edge and bottom edge. Thus is your image is not an exact multiple of 8/16 it will contain incomplete blocks, which will end up on the wrong edge after rotation.

I verified the above assertion using the version of Windows Photo Viewer that ships with Windows 7. I used two images of colour noise. One image was 256x256 i.e. both sizes multiples of 8. The other image was the same but cropped to 253x253 i.e. neither size was a multiple of 8. Here are the images:



I then performed four anti-clockwise rotations, closing photo viewer after each rotation to ensure the image was saved in it's rotated state.



There's no need to perform a subtraction to see the difference with the 253 pixel image, it's noticeably darker and muddier!

A diff on the other image looks like this:

i.e. the images are identical, the rotations were lossless.

Matt Grum
Matt Grum
May 24, 2011 12:26 PM

Related Questions

Updated September 06, 2018 22:18 PM

Updated March 06, 2019 18:18 PM

Updated May 25, 2017 19:18 PM

Updated May 09, 2017 03:18 AM

Updated June 30, 2016 08:07 AM