5
\$\begingroup\$

I need the exact opposite of How to remove orientation attribute from the photo without touching other exif-data?

I want to keep the EXIF rotation data, but I want to strip the rest of the data. Obviously I can use exiftool -all= file.jpg but that will remove the orientation data as well, which is undesirable.

Is there a way to keep only the rotation data with exiftool? I could use exiftran or something similar, but I'd rather just leave only the rotation data.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You might also want to keep colour profiles in the image's metadata so that the colours are displayed is intended. \$\endgroup\$
    – Flimm
    Mar 4, 2022 at 23:13

2 Answers 2

4
\$\begingroup\$

Duplicate of this StackOverflow question

exiftool -all:all= -tagsfromfile @ -exif:Orientation /path/to/files 

-all:all= removes all data, then Orientation is copied back into the file with the -TagsFromFile option.

Do not run this command on RAW files (NEF, ARW, CR2, etc.; see Exiftool FAQ #8). This command creates backup files. Add -overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories.

\$\endgroup\$
-2
\$\begingroup\$

A bit of a hack, but if you're on a Unix-like system, you can use backticks to re-inject the desired value into the image:

exiftool -all= -Orientation=`exiftool -b -Orientation file.jpg` file.jpg

Note that the -b flag is important so that the tag value is outputed without the tag name (see here for more).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.