ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: dima on February 02, 2020, 01:50:33 PM

Title: I want to rotate a lot of pictures, but does not work
Post by: dima on February 02, 2020, 01:50:33 PM
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

Title: Re: I want to rotate a lot of pictures, but does not work
Post by: Phil Harvey on February 02, 2020, 07:26:24 PM
Try this:

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

- Phil
Title: Re: I want to rotate a lot of pictures, but does not work
Post by: 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?
Title: Re: I want to rotate a lot of pictures, but does not work
Post by: Phil Harvey on February 03, 2020, 02:05:29 PM
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
Title: Re: I want to rotate a lot of pictures, but does not work
Post by: Alan Clifford on February 03, 2020, 02:08:17 PM
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.

Title: Re: I want to rotate a lot of pictures, but does not work
Post by: dima on February 03, 2020, 02:27:16 PM
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?
Title: Re: I want to rotate a lot of pictures, but does not work
Post by: Hayo Baan on February 03, 2020, 03:06:29 PM
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).
Title: Re: I want to rotate a lot of pictures, but does not work
Post by: dima on February 04, 2020, 11:07:22 AM
Thanks, that was the Solution  :)