Main Menu

Rotation cases

Started by JanK, November 27, 2011, 01:18:39 PM

Previous topic - Next topic

JanK

I am know on a point to correct the rotation of my images.

How does the rotation in cameras work? Are there some methods?

For example a camera make pictures in 4000px X 3000px (WxH). For know the camera can also recognize the orientation of the body. How is rotation stored in the file? Does it make pictures in 4000x3000 and 3000x4000 or does it save the picture always in 4000x3000 and add the correct rotation information to the metadata.

which tags should I edit to correct the orientation of the image?
-Mac OSX Mountain Lion-

Phil Harvey

Most cameras write the same JPEG image independent of the camera orientation.  The only difference is usually the value of the EXIF Orientation tag.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dgsjsj

Recently, the Olympus-xz-1 changed the firmware to the camera is properly recorded orientation of the camera.
Some viewers immediately deploy a snapshot of entries in accordance with Exif.
For example ZonerPhoto Studio

JanK

Here is an example with on an off Autorotate Function in the camera Canon IXUS 80IS (Pictures are shown in OSX (Finder). Windows does not consider the Meta information "Orientation" and displays the pictures wrong.) The camera itself save the rotation even it is turned off in the camera settings. You can see this in the special MakerNotes section off Canon (AutoRotate and Rotation) This means not the setting of Autoration in the camera because you cann see in the table below with an OFF Autorotate it saves the Rotation information in the MakerNotes. But other software than canon might only recognize the "[EXIF:IFD0] Orientation" Furthermore by this camera the pictures are saved in landscape whatever the settings are.

Question:

  • When I have pictures with Metadate like that and I have a wrong rotation because it was turned off or whatever. How should I rotate the picture? I don't take a look in my other pictures from other cameras but I know that the rotation is wrong. So there could be any other Tags which are in relation to the rotation information.
  • And what happen to the thumbnail? Is there Metadate information which rotates the thumbnail separately?
  • And what when I rotate the picture (not the Meta information) with an lossless image rotation software (4000x3000 => 3000x4000). The tags (Camera own tags too) should be set to horizontal too. And what is done to the thumbnail in this fact?
AUTO ROTATE BY CAMERA ON





































Autorotate by camera ON    Autorotate by camera ON    Autorotate by camera ON   
SourceTag Name





[File]    ImageWidth    326432643264
[File]    ImageHeight    244824482448
[EXIF:IFD0]    Orientation    Horizontal (normal)Rotate 90 CWRotate 270 CW
[EXIF:ExifIFD]    ExifImageWidth    326432643264
[EXIF:ExifIFD]    ExifImageHeight    244824482448
[MakerNotes:Canon]    AutoRotate    NoneRotate 90 CWRotate 270 CW
[MakerNotes:Canon]    Rotation    090270
[MakerNotes:Canon]    CanonImageWidth    326432643264
[MakerNotes:Canon]    CanonImageHeight    244824482448
[EXIF:InteropIFD]    RelatedImageWidth    326432643264
[EXIF:InteropIFD]    RelatedImageHeight    244824482448
[Composite]    ImageSize    3264x24483264x24483264x2448







AUTO ROTATE BY CAMERA OFF






































Autorotate by camera OFF    Autorotate by camera OFF    Autorotate by camera OFF   
SourceTag Name





[File]    ImageWidth    326432643264
[File]    ImageHeight    244824482448
[EXIF:IFD0]    Orientation    Horizontal (normal)Horizontal (normal)Horizontal (normal)
[EXIF:ExifIFD]    ExifImageWidth    326432643264
[EXIF:ExifIFD]    ExifImageHeight    244824482448
[MakerNotes:Canon]    AutoRotate    NoneRotate 90 CWRotate 270 CW
[MakerNotes:Canon]    Rotation    090270
[MakerNotes:Canon]    CanonImageWidth    326432643264
[MakerNotes:Canon]    CanonImageHeight    244824482448
[EXIF:InteropIFD]    RelatedImageWidth    326432643264
[EXIF:InteropIFD]    RelatedImageHeight    244824482448
[Composite]    ImageSize    3264x24483264x24483264x2448





-Mac OSX Mountain Lion-

Phil Harvey

These are all questions that only you can answer.  Personally, I rotate all of my images with jpegtran and I don't worry about rotating the thumbnail.  In theory, the thumbnail orientation can be set with IFD1:Orientation, but I don't know what (if any) software honours this metadata.  When the image is rotated, IFD0:Orientation (the main image orientation) should be reset to Horizontal.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JanK

I lack the experience with it. So I asked here.

When I use a software to manipulate the Metadata or rotate the image maybe with jpegtran I think the MakerNotes or Thumbnail tags a will not be touched. So I don't know if that brings any problems in some software.

In my pictures I can't find any IFD1:Orientation. Is thumbnail rotation not saved by every camera?

Do you know what software on Mac use the thumbnail data which is stored in the picture? Or is it used by all software. For Example Finder. Does it generate it's own thumbnails from the full picture or use it the thumbnail data in the Metadata?

P.S Do you know if it is possible to install jpegtran separately? Not in combination with the other tools.
-Mac OSX Mountain Lion-

Phil Harvey

#6
I don't know of any camera offhand that stores IFD1:Orientation. When I rotate an image with jpegtran, it does not change any EXIF. I don't remember having to install anything else when I installed jpegtran on my Mac, but that was a long time ago so I could have forgotten.

I don't know what Mac software uses the thumbnail, but at only 160 pixels wide, it is too small for many purposes.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JanK

I thought because you mentioned in some threads the IDF1:Orientation that there are cameras or softwares which use this information. Good for me because I have not to think about any problems with it.

I thought when there is a thumbnail in the file then software take use of it. But it seems that this is a relict from a time where computers are very slow and today it is not necessary to use it.

I was unsure when I rotate the picture (exif or physical) because there are other tags which are associated with the orientation. By rotating the image with jpegtran or any other software some inconsistency will be left in the Metadata. For example the MakerNotes of Canon said that it has to be rotated but you already changed the physical orientation. But for now I think it is not very critical because these tags are not used by popular software.
-Mac OSX Mountain Lion-

Phil Harvey

Quote from: JanK on December 02, 2011, 05:40:23 PM
I thought because you mentioned in some threads the IDF1:Orientation that there are cameras or softwares which use this information.

Actually, the reason I mentioned it is because it is mentioned in the EXIF specification, but at the time I hadn't checked to see what cameras write this information.

I have just run through my set of sample images, and am surprised to see that cameras from many manufacturers do store this information...

Notable makes that use IFD1:Orientation:

FujiFilm, HP, Kodak, Panasonic, Pentax (compact models), Samsung, Sony

Notable makes that don't:

Canon, Nikon, Olympus, Pentax (DSLR models)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JanK

Hi Phil,

I'm near to rotate my pictures to a right orientation so I began to read about orientation tools.

1.
You use jpegtran and I found the following information on it's site
Quotejpegtran does not change the Orientation Tag when performing lossless transformations.
http://jpegclub.org/exif_orientation.html
Correct me if I'm wrong but with this it will occure a wrong orientation in all softwares who consider the orientation tag.

2.
And what are you doing with this proble (http://jpegclub.org/exifpatch.html
QuoteIJG based software writes a JFIF APP0 marker between SOI and Exif APP1 marker.
According to the Exif specification, the Exif APP1 marker has to follow immediately after the SOI, just as the JFIF specification requires the same for the JFIF APP0 marker!
Therefore a JPEG file cannot legally be both Exif and JFIF at the same time!

QuoteInserted in the code is a new local function adjust_exif_parameters() (located above jtransform_adjust_parameters()). The function is called from a new code fragment in function jtransform_adjust_parameters() below, titeled "Adjust Exif properties". After checking for a valid Exif marker, the JFIF marker output is suppressed by setting the dstinfo->write_JFIF_header field to FALSE. As in function jcopy_markers_execute(), examining the copy option flag can be avoided by just checking the srcinfo->marker_list field, which is set accordingly due to jcopy_markers_setup(). Also note that the APP1 marker must be the first marker according to the Exif spec, so we don't need to traverse the whole marker_list.
Does this mean I have to set something to not violate the Exif Specifikation? Or will jpegtran do this alone?
-Mac OSX Mountain Lion-

Phil Harvey

Quote from: JanK on December 23, 2011, 01:28:09 AM
Quotejpegtran does not change the Orientation Tag when performing lossless transformations.
http://jpegclub.org/exif_orientation.html
Correct me if I'm wrong but with this it will occure a wrong orientation in all softwares who consider the orientation tag.

You are correct.  Use ExifTool to set the Orientation to Horizontal after rotating with jpegtran.

Quote2.
And what are you doing with this proble (http://jpegclub.org/exifpatch.html

In practice, I have encountered no software which will ignore EXIF just because it comes after a JFIF segment.  So I don't worry about this myself.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).