Return to Digital Photography Articles

Digicams and Lossless Rotation

Unfortunately, there are a number of digital cameras that use standard resolutions that are not well suited for JPEG lossless rotation. This page identifies some of these exceptions.

Lossless Rotation and Partial MCUs

For relevant background material, please have a look at JPEG compression, JPEG minimum coded unit (MCU) and lossless rotation with partial MCU. In general, lossless image rotation requires image dimensions to be integer multiples of 16 pixels for it to work.

Digicams with Bad Resolution Sizes

There are several digicams on the market today that have selected output resolutions that will make lossless rotation impossible to achieve (when using JPEG mode). The following tables identify some of these violators.

Digicams with Partial MCU

Surprisingly, there are a few cameras that produce images with resolutions that aren't integer multiples of the 8x8 pixel MCUs!

Unfortunately, this will practically guarantee that lossless image rotation will not be possible, as the luminance component is never subsampled and requires 8 pixels to complete a minimum coded unit (JPEG image tile).

I am unsure why the digital camera manufacturers didn't seem to take this into account before selecting the output image dimensions. The CMOS or CCD sensor's real image resolution is generally cut down slightly to create a resulting effective resolution (the trimmed off space can be used for noise removal or just a cleaner edge). Therefore, the loss of an additional 4 or 8 pixels in one image dimension would seem to be preferrable than to create an image that doesn't completely fill the JPEG MCU. By not using an integer multiple of the MCU dimension, image encoders and decoders will always have some uncertainty in how these edge pixels should be handled.

Resolution
(Megapixels)
Dimensions
(Pixels)
Aspect RatioCamera Make
13.500 4500x3000 3:2Kodak
6.133 3042x2016 3:2 ~ Fuji (SLR)
4.985 2580x1932 4:3 ~ Kodak
4.977 2576x1932 4:3 Kodak
3.429 2268x1512 3:2 Sigma (SLR)

 

It is interesting to note that some digicam manufacturers have apparently realized the problem that these partial MCU cause and modified the image dimensions slightly between models. An example of this is Kodak, where one model uses 2580x1932 and another uses 2576x1932 (a difference of only 4 pixels!).

Digicams with Problems due to Chroma Subsampling

Chroma subsampling is used in nearly all digital cameras (usually 2x1, but sometimes 2x2 in cheaper cameras). One of the repercussions of chroma subsampling is that it effectively makes the Minimum Coded Unit (MCU) 16 pixels instead of 8. The following digicams have at least one image dimension that is an integer multiples of 8x8 pixels, but not 16x16 pixels.

From the perspective of Windows Picture and Fax Viewer, lossless rotation is not possible. However, these photos can be easily rotated losslessly by utilities such as IrfanView or jpegtran, BetterJPEG and other similar programs.

During image rotation, the chroma subsampling "orientation" should also be rotated. In other words: if an image originally had 2x1 chroma subsampling (horizontal axis), then after rotation by 90 or 270 degrees, the resulting subsampling will be 1x2 (i.e. on the vertical axis).

For example: let's take a photo that is 2272x1704 with the standard 2x1 chroma subsampling. When the image is compressed using JPEG compression, the luminance (brightness information) uses the full resolution of 2272x1704, but the chrominance (color information) is first reduced to 1136x1704 before compression. In this example, both the luminance and chrominance have dimensions that are integer multiples of 8x8 (284x213 and 142x213 tiles/MCUs respectively). Therefore, there should be nothing preventing lossless image rotation from being performed.

It is unclear why Windows XP Explorer and Windows Picture and Fax Viewer cannot handle lossless rotation of images that fall in this category, as it certainly is possible. As a result, users will be faced with the message shown below.

Strangely enough, I have observed that when Windows attempts to rotate images that in this category, the resulting photo has a chroma subsampling of 2x2. This likely explains the reason why it believes that lossless rotation is not possible. If it applies 2x2 chroma subsampling, then there will in fact be a dimension of the chrominance channel that has partial MCUs! To me this appears to be a bug and/or bad assumption on the part of Microsoft.

"Because of the dimensions of this picture, rotating it might permanently reduce its quality."

Take this as a warning NOT to rotate the image with Windows, and instead use a different program! The image degradation can be quite significant.

Resolution
(Megapixels)
Dimensions
(Pixels)
Aspect RatioCamera Make
9.125 3488x2616 4:3 Fuji
7.017 3056x2296 4:3 Pentax
6.234 3056x2040 3:2 ~ Pentax
6.088 3032x2008 3:2 ~ Kodak (SLR)
6.040 3008x2008 3:2 ~ Sigma, Pentax, Samsung
5.896 3008x1960 3:2 ~ Nikon
6.083 2848x2136 4:3 Fuji
5.039 2592x1944 4:3 Canon, Fuji, Kokak, Nikon, Sony, Olympus, Pentax, Samsung
4.320 2400x1800 4:3 Fuji
3.871 2272x1704 4:3 Canon, Fuji, Konica Minolta, Nikon, Sony, Nikon, Olympus, Panasonic, Samsung

 

In the above tables, a tilde (~) indicates that the image aspect ratio is not exactly 3:2 (1.500) or 4:3 (1.333).

Corruption from Rotation

If you did perform a non-lossless (lossy) rotation with Windows XP Explorer or Windows Picture and Fax Viewer, you will unfortunately suffer image degradation across the entire image area, not just on the outer peripheral edges. It is not smart enough to truncate the partial tiles and do a lossless transform, or handle images with partial . The actual amount of image degradation can be quite significant, easily visible in an un-enhanced difference overlay in Photoshop.

Missing your digicam?

The above lists were extracted from hundreds of digital cameras that I have examined that provide an image resolution over 3 megapixels. If you see the Windows XP rotation warning (shown above) from your image and it is not an image dimension shown above, please leave a comment below. Similarly, if you have images from your digital camera with an image dimension shown above, but Windows XP doesn't give you such a warning, I would be interested to hear it!

 


Reader's Comments:

Please leave your comments or suggestions below!
2009-01-07Dan
 Does Windows Vista handle rotations properly? I don't recall ever getting the pop-up when trying to rotate Fuji images. thanks!
 Great question. I just tested a 2592x1944 Canon image and it appears that Windows Vista (also known as Microsoft Windows Photo Gallery 6.0) is indeed performing the rotation losslessly.
2007-12-30Danny
 I am looking to buy my first digital camera and was doing some investigation. Your site is very informative. On any digital photo that I print or view in a slideshow I want to show the Y/M/D date info imprinted on the photo/image. I notice in the 'Features' description of the Panasonic DMC-FX100 camera that if I use Date Stamp function the photo is automatically resized from 12 megapixels to 3 megapixels. This is not stated in the camera OI manual or the specs, just in the Features section. Do you know why this happens? Is it related to what you are talking about on your site? Would this be common to other cameras even though the literature may not say it? What is my alternaive to avoid this degredation and still show a date stamp? Thanks
 It is hard to say why the resizing is done when in datestamp mode. Two possibilities come to mind: 1) desire to reduce image editing buffer size (if datestamp is applied by camera firmware rather than hardware) or 2) the assumption is made that date-stamped photos are more likely "snapshots" and won't need the resolution.

All this is besides the point: I would strongly recommend using a software solution to imprint timestamps instead of relying on the camera to do it for you. Not only do you have the option of preserving your original image, but you can also change the appearance of the date, in addition to having the freedom to choose any camera model!

There are many free tools that will do datestamping of images from EXIF metadata (have a quick search in Google). Keep in mind that most of these will cause a full recompression of your image. If you are looking to datestamp your photos while introducing the least amount of degradation (from recompression), I strongly recommend you consider BetterJPEG.
2007-01-11Gordon
 Are there any Canon or Nikon models that output resolutions that make lossless rotation in Windows Picture and Fax Viewer possible?

 


Leave a comment or suggestion for this page:

(Never Shown - Optional)
 

Visits!