TransWikia.com

How do I use exiftool to strip all exif tags except rotation?

Photography Asked on April 1, 2021

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.

2 Answers

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.

Correct answer by StarGeek on April 1, 2021

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

Answered by Kahovius on April 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP