Troubles deleting all but a specific item from image

Started by oren, April 10, 2021, 06:08:20 AM

Previous topic - Next topic

oren

I'm trying to delete all the metadata of a given image except for the EXIF:Orientation field.
I've tried several approaches but haven't found a good solution yet.

1. simple approach: exiftool -all= --orientation {file} -- clears everything including the orientation tag
2. read from file: I saw the suggestion to use the -tagsFromFile: exiftool -all= -tagsfromfile @ -orientation {file} - works ok (but a little slow), but seems to HANG after processing some files. typically after about 60 files are processed (depending on the computer running this), the tool hangs. I've investigated this using ProcessMonitor and can see that the tool hangs in the middle of the process. I've been able to run this method flawlessly for an unlimited amount of files, but under the specific runtime conditions I'm using, I'm seeing this reproduced consistently and at exactly the same point. It doesn't seem like a race condition (since it happens at exactly the same time). maybe something related to memory usage or the amount of handles left open.
3. using -2all:all= : exiftool -2all:all= --orientation {file} -- this DOES work, but is very slow. it literally takes a few seconds to erase the exif data of a single file.

I'd appreciate any help or nudge in the right direction. I've been playing around with this for a VERY long time and I seem to run into a dead-end on every attempt.

I've attached a sample image with rotation.

My system configuration: Windows 10, Exiftool 12.2.3

Oren

Phil Harvey

The docomentation for --TAG mentions that a single tag can't be excluded from a group delete.

The hang problem is likely a shortage of memory.  When memory gets tight, exiftool can run REALLY slowly.  It may actually complete the process if you wait long enough.  The memory handling of the alternate Windows version may be different -- you might give this a try.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Luuk2005

Im curious if -all= -Orientation"<Orientation" would conduct any faster????
Windows8.1-64bit,  exiftool-v12.92(standalone),  sed-v4.0.7

StarGeek

Exiftool should be about the same speed as copying the file. For it to take several seconds, the file either has to be large or on a network source.  For example, editing a large, 5 gig video file on a networked drive will take some time.  Or running a command on 1,000 RAW files will be longer than running on 1,000 100x100 thumbnails.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).