3

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.

4

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, 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.

-2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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