News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

I want to rotate a lot of pictures, but does not work

Started by dima, February 02, 2020, 01:50:33 PM

Previous topic - Next topic

dima

That does not work. Why?

find . -iname "*.jpg" -print0 | xargs -0 exiftool -Orientation=1 -n "$@"

This works with one Picture or Folder, but not recursiv.
exiftool -Orientation=1 -n "$@" *.jpg


Phil Harvey

Try this:

exiftool -n -orientation=1 -r -ext jpg "$@"

- 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 ($).

dima

Some pictures do not rotate automatically. Does this work with every picture? or how can I recognize that whether the picture can be rotated?

Phil Harvey

Whether or not the picture is rotated depends on

1. the initial orientation of the image

2. the software you are using and whether or not it honors the 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 ($).

Alan Clifford

Quote from: dima on February 03, 2020, 01:56:02 PM
Some pictures do not rotate automatically. Does this work with every picture? or how can I recognize that whether the picture can be rotated?

Is this the problem:

-orientation  does not rotate a photograph, it sets a flag that software can recognise to display the photo in a certain orientation.  -orientation=1 will inform the software that the photo is landscape and the right way up.

1 = Horizontal (normal)
2 = Mirror horizontal
3 = Rotate 180
4 = Mirror vertical
5 = Mirror horizontal and rotate 270 CW
6 = Rotate 90 CW
7 = Mirror horizontal and rotate 90 CW
8 = Rotate 270 CW

Edit: if a photo has been physically rotated to be in portrait mode, you would also want -orientation=1.


dima

OK, thank you for your efforts.

but why does that only work if I'm in the folder.
e.g.
cd /Moments/2004/2004-01-01
find . -iname "*.jpg" -print0 | xargs -0 exiftool -Orientation=1 -n "$@"

This is ok, but when i go to:
cd /Moments/2004/

and here

find . -iname "*.jpg" -print0 | xargs -0 exiftool -Orientation=1 -n "$@"

That does not work. Why?

Hayo Baan

You shouldn't include "$@" on the xargs command-line; xargs takes care of the arguments itself. Other than that it should work (as long as find . -iname "*.jpg" indeed lists all files you are interested in).
Hayo Baan – Photography
Web: www.hayobaan.nl

dima