How to edit Apple's tag that shows which device the picture comes from?

Started by Grouaaah, February 10, 2024, 07:07:26 PM

Previous topic - Next topic

Grouaaah

Hello,

I don't think this tag is know by most users so this is why I wanted to post here.

I see there is a field on MacOS which shows the device a picture comes from when you click on the Read info button directly in the Finder. If you imported an image from an iPhone, it should show up immediately:

... Comes from... John's iPhone <XX>...


I'm wondering how I can edit or delete this tag, and where is it stored? If you know please help me, because I have never found anything about this anywhere, and GraphicConverter doesn't seem to let us delete this one.

Thank you very much,

StarGeek

Try this command to see all the tags including the unknown ones
exiftool -G1 -a -s -api RequestAll=3 -u file.jpg

I would guess that it will show up as an MDItem* or XAttr* tag, which are part of the file system and not embedded in the file.
* 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).

greybeard

Its stored in this attribute: XAttrMDItemWhereFroms

According to this link its not an Exiftool writable attribute

Exiftool Tags

The attributes can be displayed, modified or removed on the command line using xattr (but it can be a bit tricky)

wywh

That info is in the *MDItemWhereFroms tags:

exiftool -G1 -a -s -api RequestAll=2 -MDItemWhereFroms -XAttrMDItemWhereFroms a.jpg
[MacOS]         MDItemWhereFroms                : John Doe, iPhone (John)
[MacOS]         XAttrMDItemWhereFroms           : John Doe, iPhone (John)

GraphicConverter 12 can show or delete them via Browser > "Date" menu > Extended Attributes (XAttr) > Show... or Remove All...

Or via the Terminal:

xattr a.jpg

xattr -l a.jpg

ls -@l a.jpg

Remove just *MDItemWhereFroms:

xattr -d com.apple.metadata:kMDItemWhereFroms a.jpg
Remove all extended attributes:

xattr -c a.jpg
xattred.app lets you inspect and edit all extended attributes (xattrs) associated with a file or folder, cut/copy/paste any xattr between files or folders, create your own new xattrs with arbitrary contents, and add a quarantine xattr to force a full Gatekeeper check without downloading the file.

https://eclecticlight.co/xattred-sandstrip-xattr-tools/

- Matti


Phil Harvey

ExifTool 12.77 (and later) will have the ability to delete XAttrMDItemWhereFroms.

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

wywh

FYI: the related xattr macOS 14 Finder comments are a mess (I have never really used them anyway):

Edited Finder comments are stored in an invisible .DS_Store in the same folder as the document, and a secondary copy is generated in a xattr metadata com.apple.metadata:kMDItemFinderComment for the file.

Finder only seems to know about the first. Conversion between the hidden .DS_Store file and the file's xattr is one-way. There's no syncing in the other direction.

So if the .DS_Store file is lost or out-of-sync (in non-Mac file system or via some backup workflow etc), then the Finder Get Info no longer displays the comment although the xattr metadata still has it. When testing, notice that Finder caches that info so peeking into the folder in some part of the workflow might make a difference.

https://eclecticlight.co/2020/11/06/finder-comments-worth-avoiding/

https://bombich.com/kb/ccc6/preserving-finder-comments-and-tags

exiftool 12.76 can clear Finder comment with '-MDItemFinderComment=' command so that info is cleared also in the .DS_Store and in the Finder Get Info dialog:

cat .DS_Store
Bugcmmtustra.jpgcmmtustrFinder comment.

exiftool -G1 -a -s -api RequestAll=2 -MDItemFinderComment -XAttrMDItemFinderComment a.jpg
[MacOS]         MDItemFinderComment             : Finder comment.
[MacOS]         XAttrMDItemFinderComment        : Finder comment.

exiftool -overwrite_original -XAttrMDItemFinderComment= a.jpg                           
Warning: Sorry, XAttrMDItemFinderComment is not writable
Nothing to do.

exiftool -G1 -a -s -api RequestAll=2 -MDItemFinderComment -XAttrMDItemFinderComment a.jpg
[MacOS]         MDItemFinderComment             : Finder comment.
[MacOS]         XAttrMDItemFinderComment        : Finder comment.

exiftool -overwrite_original -MDItemFinderComment= a.jpg                                 
    1 image files updated

exiftool -G1 -a -s -api RequestAll=2 -MDItemFinderComment -XAttrMDItemFinderComment a.jpg
[MacOS]         MDItemFinderComment             :
[MacOS]         XAttrMDItemFinderComment        :

cat .DS_Store                                                                           
Bugcmmtustra.jpgcmmtustr

...

Some tests:

xxd .DS_Store
00000000: 0000 0001 4275 6431 0000 1000 0000 0800  ....Bud1........
00000010: 0000 1000 0000 0086 0000 0000 0000 0000  ................
00000020: 0000 0000 0000 0000 0000 0000 0000 0800  ................
00000030: 0000 0800 0000 0000 0000 0000 0000 0000  ................
00000040: 0000 0000 0000 0002 0000 0000 0000 0001  ................
00000050: 0000 0001 0000 1000 0067 636d 6d74 7573  .........gcmmtus
00000060: 7472 0000 0000 0000 0000 0000 0000 0000  tr..............
00000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000080: 0000 0000 0000 0000 0000 0001 0000 0005  ................
00000090: 0061 002e 006a 0070 0067 636d 6d74 7573  .a...j.p.gcmmtus
000000a0: 7472 0000 000f 0046 0069 006e 0064 0065  tr.....F.i.n.d.e
000000b0: 0072 0020 0063 006f 006d 006d 0065 006e  .r. .c.o.m.m.e.n
000000c0: 0074 002e 0000 0000 0000 0000 0000 0000  .t.

xattr -l a.jpg
com.apple.metadata:kMDItemFinderComment: bplist00_Finder comment.

Finder comment edited with xattred.app -- these tags are not synced and Get Info still shows the old "Finder comment." saved in .DS_Store anyway:

exiftool -G1 -a -s -api RequestAll=2 -MDItemFinderComment -XAttrMDItemFinderComment a.jpg
[MacOS]         MDItemFinderComment             : Finder comment.
[MacOS]         XAttrMDItemFinderComment        : Edited.

- Matti