Как я могу изменить тег ориентации EXIF ​​изображения?

12406
Islam Wazery

Я хочу изменить тег ориентации EXIF ​​в моих изображениях JPEG, но без их фактического поворота. Я хочу сделать это, чтобы использовать их в качестве тестового примера для приложения, которое я сделал.

Как я могу сделать это в Linux? Могу ли я сделать это с exiftool? И если да, то как?

14

1 ответ на вопрос

21
Breakthrough

You can retrieve the existing orientation information via exiftool as follows:

exiftool -Orientation -n image.jpg 

This will display the internal value of the orientation information held in the MIE tags. You can return the value as an English string by omitting the -n flag. You can find additional information here regarding particular rotation/orientation values.

Changing the orientation data with exiftool can be done as follows:

exiftool -Orientation=1 -n image.jpg 

Here, the orientation is set to 1, indicating no rotation. These numbers are defined as per the EXIF specification; you can see what effect different rotation values have in the link above.

(note: you must use the -n argument when setting orientation to indicate that the value is numeric. If you forget, exiftool will interpret the orientation=x number as a string and set the wrong rotation ie. exiftool -orientation=1 image.jpg will actually set the orientation to 3 which is 'Rotate 180')

Похожие вопросы