EEVblog > News/Suggestions/Help

Does the forum support EXIF orientation tag in JPEG images?

(1/2) > >>

magic:
Only one way to know...
 :popcorn:

magic:
The preview generator clearly doesn't.

Moreover, the tag is stripped from the uploaded image as well, so downloaded copies appear wrong in all browsers and other software.

magic:
Ehm, yes, for those wondering what this is about.

JPEG files may contain EXIF metadata. One item of particular interest is the Exif.Image.Orientation tag, which - if present - specifies that the image should be rotated (in 90° increments) or mirrored before being shown to the user. A common source of such images are digital cameras in portrait orientation - they actually write the file in landscape orientation and then add this EXIF tag. Another source is some simple image editors and viewers, which implement "rotate left"/"rotate right" functions on JPEGs by means of altering the EXIF tag only.

Needless to say, not all software honors this EXIF tag and some websites remove some or all EXIF tags from images uploaded by users, with or without correcting the orientation. The ZIP archive attached to this post contains a JPEG file which tests any software for handling of EXIF orientation. The image is encoded upside down, and then an EXIF tag is added requesting 180° rotation.

Fixing orientation the easy way.
Open and then save the image again with a graphics editor which encodes JPEGs in correct orientation right away, without EXIF trickery. The free image editor GIMP is one such program and I suspect even MS Paint could work, if it still exists in Windows. When loading a JPEG file, GIMP will ask whether to rotate the image in accordance with EXIF metadata, you probably want to answer "yes" to that if you are here. To write a JPEG file in GIMP, you need the "export" function rather than "save" ::)

This is an opportunity to also reduce the size of your file by scaling down to fewer pixels and/or reducing the "JPEG quality factor", if no visible deterioration occurs.

Rotating JPEG images the lossless way.
The decode-encode loop described above induces quality loss, which may be undesirable if the original image already suffers from high compression. Saving at a higher quality factor could reduce the additional loss, but increases file size quite needlessly.

A few simple transformations including rotation can be performed on JPEGs losslessly, with specialized software which manipulates the compressed data directly. The image remains the same in size and decodes to the exact same pixels, but in different orientation. Limited scaling and cropping is possible too.

Free tools for this are jpegtrans and jpegcrop, developed by https://jpegclub.org/ .

BONUS: Lossless extraction of JPEGs (and other images) from PDF documents.
This can be handy too, because the file is not scaled or re-encoded in the process. Some PDF editors like LibreOffice can save images embedded in PDF documents to individual files. Some PDF images are encoded in JPEG format and should be saved us such, others are lossless and may be saved as PNG.

An alternative option on Linux is the pdfimages command line tool.

thm_w:
I guess this explains why saving some images the correct rotation is lost as its a tag.

It looks like in windows the built in rotate image is lossless: https://photo.stackexchange.com/questions/12361/are-windows-photo-viewer-rotations-lossless

Peabody:
I have the same problem with portrait mode pictures taken with my Canon T2i DSLR. They are saved  by the camera in landscape mode on the SD card, and I have found that various apps may or may not correct the orientation.  So I point JPEG Lossless Rotator (for Windows) to the folder, and it automatically re-writes those pictures into actual portrait mode format, without bothering those actually taken in landscape mode in the first place.  And it doesn't change anything else, like the date/time values.  I'm told there is a menu entry in the camera that fixes this problem, but I think that applies only if you use Canon's software to bring in the pictures.  Not sure about that.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version