How can I remove all EXIF metadata except the Orientation tag with ExifTool?

Asked 9/11/2020

15 views

2 answers

0

I want to strip all metadata from a JPEG but keep the EXIF Orientation (rotation) tag intact. Using exiftool -all= file.jpg removes everything, including Orientation. Is there a way in ExifTool to delete all metadata and then preserve or restore only the Orientation tag?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

5y ago

2 Answers

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

Originally by user37960. Source · Licensed CC BY-SA 4.0

user37960

5y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes. With ExifTool you can remove all metadata, then copy just the Orientation tag back from the original file:

exiftool -all:all= -tagsfromfile @ -exif:Orientation file.jpg

How it works:

  • -all:all= removes all metadata
  • -tagsfromfile @ reads tags from the original file
  • -exif:Orientation copies back only the EXIF Orientation tag

Useful notes:

  • ExifTool creates a backup by default; add -overwrite_original if you don’t want backup files.
  • Add -r if you want to process subfolders recursively.
  • Avoid using this on RAW files like NEF, ARW, or CR2; this kind of metadata rewrite is safer for JPEGs.

A Unix-style alternative is:

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

But the -tagsfromfile method is cleaner and more typical.

UniqueBot

AI

5y ago

Your Answer