Can Overwrite Original Keep Extension Hidden?

Started by Chris S, February 04, 2023, 08:06:50 PM

Previous topic - Next topic

Phil Harvey

Either link is forcing me to log in to box.com now.  The first time I tried it gave me a download button, but now it won't, and I don't want to create an account. :(

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

Chris S

Just sent it to your email... LMK if that works. Thanks!

Phil Harvey

The mail didn't work, but I broke down and created a box.com account so I could download it.  The problem is that all of the time is spent loading the metadata that you are using in your -if condition (ie. the DocumentAncestors list is huge -- it contains 639333 entries -- a classic example of Adobe XMP bloat).

The IgnoreTags doesn't help because the cause of the slowdown is the DocumentAncestors tag which must be loaded because it is used in your -if condition.

However, ExifTool will only read 1000 of these entries by default, so just drop the -m option from your command (as in my 2nd command below) and it will speed things up significantly to be nearly the same speed as without the -if option (3rd command below):

> cp ~/Desktop/MetadataTesting.tif a.tif
> time exiftool a.tif -if2 '$description or $imagedescription or $caption-abstract or $documentancestors' -overwrite_original -XMP-photoshop:DocumentAncestors= -description= -ImageDescription= -Caption-Abstract= -m
    1 image files updated
40.201u 0.451s 0:40.67 99.9%    0+0k 0+0io 0pf+0w
> cp ~/Desktop/MetadataTesting.tif a.tif
> time exiftool a.tif -if2 '$description or $imagedescription or $caption-abstract or $documentancestors' -overwrite_original -XMP-photoshop:DocumentAncestors= -description= -ImageDescription= -Caption-Abstract=
Warning: [minor] Excessive number of items for photoshop:DocumentAncestors. Processing may be slow - a.tif
    1 image files updated
17.468u 0.346s 0:17.82 99.8%    0+0k 0+0io 0pf+0w
> cp ~/Desktop/MetadataTesting.tif a.tif
> time exiftool a.tif -overwrite_original -XMP-photoshop:DocumentAncestors= -description= -ImageDescription= -Caption-Abstract=
Warning: [minor] Excessive number of items for photoshop:DocumentAncestors. Processing may be slow - a.tif
    1 image files updated
16.104u 0.259s 0:16.37 99.8%    0+0k 0+0io 0pf+0w

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

Chris S

Great! Thank you Phil. Looks like the fastest the DocumentAncestors can be wiped on this file is about 8.5 seconds on my system; was hoping there might be a way to do that even faster, but at least the if statement is much improved!

When wiping the DocumentAncestors it adds about 2 seconds to wipe the 3 description fields as well, even if there is nothing present in them. Will look at finding a way to only overwrite DocumentAncestors if the 3 descriptions are blank, or only the 3 descriptions if the DocumentAncestors is already empty.

Will also see if I can figure out a way to run concurrently on a folder of images. Thinking of getting those tags first, and then building commands based on tags returned from those, then running individually/concurrently per image.