Can Overwrite Original Keep Extension Hidden?

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

Previous topic - Next topic

Chris S

Is there a way to edit the code below so the extension visibility is the same as the original? (This makes the extension visible, even if the original was hidden.)
exiftool -m -overwrite_original -XMP-photoshop:DocumentAncestors= -description= -ImageDescription= -Caption-Abstract= DIR* I'm working on MacOS Monterrey.

StarGeek

I don't use a Mac, so I can't really help here, as nothing changes on Windows.

If I had to guess, there might be an MDItem/XAttr that is lost.  You can try the -overwrite_original_in_place option instead of -overwrite_Original, but it will increase processing time as exiftool has to write the file twice.  See the link for details.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Hubert

Quote from: StarGeek on February 04, 2023, 08:17:02 PMIf I had to guess, there might be an MDItem/XAttr that is lost.  You can try the -overwrite_original_in_place option instead of -overwrite_Original, but it will increase processing time as exiftool has to write the file twice.

Yes.

The macOS -XAttr tags, including -XAttrFinderInfo, which I believe stores this setting, aren't writable by ExifTool and aren't copied when using -overwrite_original, but they are retained when using -overwrite_original_in_place.

There are a number of command-line/AppleScript solutions for modifying Finder's show/hide extension setting in this post at superuser.com.

If you're feeling really adventurous you could also try man xattr in Terminal. There are some examples of copying FinderInfo attributes, but they're way above my head...

Phil Harvey

I get these changes to the MacOS metadata/attributes when I hide the extension of a file (named "a.jpg"):

> MD Item Alternate Names         : a.jpg
12c13
< MD Item Display Name            : a.jpg
---
> MD Item Display Name            : a
17c18
< MD Item FS Finder Flags         : 0
---
> MD Item FS Finder Flags         : 16
20c21
< MD Item FS Is Extension Hidden  : 0
---
> MD Item FS Is Extension Hidden  : 1
40a42
> X Attr Finder Info              : Type='' Creator='' Flags=[4] Label=0 Pos=(0,0)

- 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

My programming skills are limited so I think -overwrite_original_in_place will be my best option to retain the extension visibility as was set in the original. I thought there was a reason I didn't go with -overwrite_original_in_place originally other than just the speed, but it appears to be working OK now. Thank you!

Chris S

#5
Trying to see if I can get this to run any faster... based on a test of 28 images ranging from 200MB to 2.4GB, it took about 45 seconds with both -overwrite_original_in_place and -overwrite_original to filter through them all. I think I'll stick with -overwrite_original_in_place since it keeps the file extension visibility as they were without additional coding. However, Wondering if it would be faster if it checked if the data existed before trying to overwrite it?

Something like -if !-description== & !-ImageDescrption== & !-Caption-Abstract== & !-DocumentAncestors== -m -overwrite_original_in_place -XMP-photoshop:DocumentAncestors= -description= -ImageDescription= -Caption-Abstract= DIR

What would this look like? Not sure if to use -if3, -if5, etc.?

exiftool -m -overwrite_original -XMP-photoshop:DocumentAncestors= -description= -ImageDescription= -Caption-Abstract= DIR

Phil Harvey

The -if would look like this:

-if2 '$description or $imagedescription or $caption-abstract or $documentancestors'

These tags should be extracted at fast level 2 because they aren't MakerNote tags.  Level 3 wouldn't extract them.

- 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

To recap since it's been a while on this topic, I am trying to wipe -DocumentAncestors, -Description, -ImageDescription and -Caption-Abstract if they exist in a folder of images with the suggested code above.

After further testing of larger images (~200MB), I'm finding with just 1 .tif it takes about 10 seconds to update the metadata in 1 file. It adds about 16 seconds (26 seconds total) for that same file if I add an -if2 statement to the command, even when there is only one file in the directory.

Any suggestions to help speed this up and why -if2 is adding so much time?

Additional observations/thoughts:
  • Both -overwrite_original and -overwrite_original_in_place took the same amount of time
  • Per Phil's suggestion, -if2 was better; about 2 seconds faster than -if
  • Updating just 1 tag (-DocumentAncestors) saved about 2 seconds, but still took 8 seconds. 2 seconds could make a difference with a lot of images; perhaps only update the tag if it's empty, assuming another -if doesn't add more time?
  • Is there a way for them to run concurrently with many files instead of individually?

Code with the -if2 statement (26 seconds):
exiftool -i HIDDEN -ext png -ext jpg -ext psb -ext psd -ext tif -if2 '$description or $imagedescription or $caption-abstract or $documentancestors' -m -overwrite_original -XMP-photoshop:DocumentAncestors= -description= -ImageDescription= -Caption-Abstract= [DIR]

Code without the -if2 statement for comparison (10 seconds):
exiftool -i HIDDEN -ext png -ext jpg -ext psb -ext psd -ext tif -m -overwrite_original_in_place -XMP-photoshop:DocumentAncestors= -description= -ImageDescription= -Caption-Abstract= [DIR]

Phil Harvey

The -if2 option still reads in a lot of information that isn't necessary in your command.

There is a fairly recent feature that I think may help a lot:

Try adding -api ignoretags=all to avoid storing all tags except those you are specifically using.

This feature was meant more to save on memory, but should speed things up a lot if there are a large number of tags.

I think the mechanism to automatically request tags mentioned in the -if condition (overriding the -api ignoretags=all for these specific tags) works, but let me know how it goes for you.

- 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

Not sure where to add that? I added -api ignoretags=all after the -overwrite_original tag in the version without the -if2 statement but it didn't do it any faster. Same was true for the one with the -if2 statement; no faster.

Phil Harvey

Interesting.

Could you send me a link to your 200 MB tiff file so I can run some tests?  (philharvey66 at gmail.com)

- 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

Here's a file you can test with...it's only 47MB, but has the same challenges.

Click here to access file via Box

Below is the result running ExifTool... since DocumentAncestors is super long I truncated those results below.

> exiftool [DIR]

ExifTool Version Number         : 12.57
File Name                       : MetadataTesting.tif
Directory                       : [DIRECTORY]
File Size                       : 47 MB
File Modification Date/Time     : 2023:03:29 12:16:04-07:00
File Access Date/Time           : 2023:03:29 12:17:47-07:00
File Inode Change Date/Time     : 2023:03:29 12:16:17-07:00
File Permissions                : -rwx------
File Type                       : TIFF
File Type Extension             : tif
MIME Type                       : image/tiff
Exif Byte Order                 : Big-endian (Motorola, MM)
Subfile Type                    : Full-resolution image
Image Width                     : 6500
Image Height                    : 10600
Bits Per Sample                 : 8 8 8 8
Compression                     : LZW
Photometric Interpretation      : CMYK
Strip Offsets                   : (Binary data 9539 bytes, use -b option to extract)
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 4
Rows Per Strip                  : 10
Strip Byte Counts               : (Binary data 4239 bytes, use -b option to extract)
X Resolution                    : 1466.455
Y Resolution                    : 1466.455
Planar Configuration            : Chunky
Resolution Unit                 : inches
Software                        : Adobe Photoshop 24.1 (Macintosh)
Modify Date                     : 2023:03:29 12:15:58
Predictor                       : Horizontal differencing
XMP Toolkit                     : Adobe XMP Core 9.0-c000 79.171c27fab, 2022/08/16-22:35:41
Creator Tool                    : Adobe Photoshop 23.4 (Macintosh)
Create Date                     : 2022:10:06 16:09:08-07:00
Metadata Date                   : 2023:03:29 12:15:58-07:00
Format                          : image/tiff
Color Mode                      : CMYK
ICC Profile Name                : U.S. Sheetfed Coated v2
Document Ancestors              : 0, 00002653DDF4551C0B851E0019C5A3A2[...TRUNCATED]
Warning                         : [Minor] Extracted only 1000 photoshop:DocumentAncestors items. Ignore minor errors to extract all
Instance ID                     : xmp.iid:ff81561e-8cf0-4e4f-8702-e193122a6747
Document ID                     : adobe:docid:photoshop:838919ff-e119-4749-bd25-1104da1c6868
Original Document ID            : xmp.did:eca600d1-5332-4178-b6ce-b6d3054776e3
History Action                  : created, converted, saved, saved, converted, derived, saved, saved
History Instance ID             : xmp.iid:eca600d1-5332-4178-b6ce-b6d3054776e3, xmp.iid:0d5a1382-71c9-4191-8cbe-4a49a596af76, xmp.iid:15479c00-e15f-4bce-bddf-39e8f99897c3, xmp.iid:46b06330-7b36-4d0a-a1d4-0ca9ff3e94ae, xmp.iid:ff81561e-8cf0-4e4f-8702-e193122a6747
History When                    : 2022:10:06 16:09:08-07:00, 2022:10:07 11:14:03-07:00, 2022:11:15 11:38:40-08:00, 2022:11:15 11:38:42-08:00, 2023:03:29 12:15:58-07:00
History Software Agent          : Adobe Photoshop 23.4 (Macintosh), Adobe Photoshop 23.4 (Macintosh), Adobe Photoshop 23.3 (Macintosh), Adobe Photoshop 23.3 (Macintosh), Adobe Photoshop 24.1 (Macintosh)
History Parameters              : from image/tiff to application/vnd.adobe.photoshop, from application/vnd.adobe.photoshop to image/tiff, converted from application/vnd.adobe.photoshop to image/tiff
History Changed                 : /, /, /, /
Derived From Instance ID        : xmp.iid:15479c00-e15f-4bce-bddf-39e8f99897c3
Derived From Document ID        : adobe:docid:photoshop:55d9b7a2-ccb1-2042-ac32-61bab23dedee
Derived From Original Document ID: xmp.did:eca600d1-5332-4178-b6ce-b6d3054776e3
Current IPTC Digest             : 6eb372def9ff76c3d0dc2248bf2b7dd3
Coded Character Set             : UTF8
Application Record Version      : 0
IPTC Digest                     : 6eb372def9ff76c3d0dc2248bf2b7dd3
Displayed Units X               : inches
Displayed Units Y               : inches
Print Style                     : Centered
Print Position                  : 0 0
Print Scale                     : 1
Global Angle                    : 30
Global Altitude                 : 30
URL List                        :
Slices Group Name               : MetadataTesting
Num Slices                      : 1
Pixel Aspect Ratio              : 1
Photoshop Thumbnail             : (Binary data 1543 bytes, use -b option to extract)
Has Real Merged Data            : Yes
Writer Name                     : Adobe Photoshop
Reader Name                     : Adobe Photoshop 2023
Color Space                     : Uncalibrated
Exif Image Width                : 6500
Exif Image Height               : 10600
Profile CMM Type                : Adobe Systems Inc.
Profile Version                 : 2.1.0
Profile Class                   : Output Device Profile
Color Space Data                : CMYK
Profile Connection Space        : Lab
Profile Date Time               : 2000:07:26 06:11:25
Profile File Signature          : acsp
Primary Platform                : Apple Computer Inc.
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : Adobe Systems Inc.
Device Model                    :
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Media-Relative Colorimetric
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : Adobe Systems Inc.
Profile ID                      : 0
Profile Description             : U.S. Sheetfed Coated v2
Profile Copyright               : Copyright 2000 Adobe Systems, Inc.
Media White Point               : 0.89256 0.92908 0.7455
A To B0                         : (Binary data 41478 bytes, use -b option to extract)
A To B2                         : (Binary data 41478 bytes, use -b option to extract)
A To B1                         : (Binary data 41478 bytes, use -b option to extract)
B To A0                         : (Binary data 145588 bytes, use -b option to extract)
B To A1                         : (Binary data 145588 bytes, use -b option to extract)
B To A2                         : (Binary data 145588 bytes, use -b option to extract)
Gamut                           : (Binary data 37009 bytes, use -b option to extract)
Image Size                      : 6500x10600
Megapixels                      : 68.9

Phil Harvey

Darn.  I downloaded the file to run some tests but erased the edited file before I realized there was a -overwrite_original in your command, so I lost it.  And the download link won't work for me again. :(

- 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

Weird, the link should should continue to work... unless you're using Box Drive and it overwrote the original on Box? Sent you an invite via email. LMK if that helps, or can upload it again.