Get Photos.app File Name from Drag

When dragging photos from Photos.app or the NSMediaLibraryBrowserControllerMBS you get a file name that looks like this;

C035854B-9A72-4B81-B5F7-CDC468A68FD1_1_102_o.jpeg

If you drag from the Photos.app you might get the file name from the drag raw data;
com.apple.pasteboard.promised-suggested-file-name

However, is there a way to get the photo title or caption set in Photos.app?

Trying to read the IPTC tags with the GMImageMBS class doesn’t provide any data. The SpotLightFileInfoMBS provides some data like the device that took the image, but not title or caption from the photos.app or the image tags.

I’ve also looked at the MLMediaLibraryMBS and the Media Library sample from MBS but for me it is only returning iTunes and iMove sources;
https://www.monkeybreadsoftware.net/class-mlmedialibrarymbs.shtml

Is there a way to get the Photo title or caption from Photos.app?

Thanks!

Apple’s “Photos” is really odd and frankly bizarre, I still can’t believe that Apple considered “Photos” to be better than Aperture (maybe in cost to maintain from Apple).

That file name you get, is probably the file name that Apple use in Photos, you can try reading the meta data using CGImage, but if it’s not in the meta data, then it’s considered “Private”. In the past you used to be able to read the iPhoto library file (as it was XML), I don’t know if it still is, but you may be able to do a reverse lookup on the file name and figure out the name.

Just wait until you try to get a RAW image from Photos… Every trick I’ve learned over the last half decade gets thwarted, if you shoot RAW at all, Photos is not for you.

1 Like

Thanks for the reply Sam!

CGImage also doesn’t seem to get the title and caption of the image.

There is an sqlite database of the images that I haven’t looked into yet though.

Very strange they don’t make this easy or provide a way.

They used to do so, we built apps that integrated into iPhoto with no problems, but of course that all changed when the CEO and Apple’s priorities changed.

1 Like