PhotosLibrary in Catalina

I see that Catalina has revised the structure of its PhotosLibrary. Under Mojave and prior it was possible to search through the Masters sub folder to get at the original images, inclusive of EXIF data etc. The new app now seems to strip those files (now held lower down in the hierarchy) of all the useful information (createdDate, exif data etc) and has added it to its internal database. I suppose this allows them to do faster searching etc.

My question is, does anyone have a way of putting that data back (in code) to restore the original file as it was prior to it being loaded into Photos?

AFAIK the library is a SQLDatabase. On my setup, it’s encrypted (by Photos I presume) and I don’t know the password, so I can’t read it. Some people say that their’s isn’t.

IMHO you need to get into the database, find the meta data (I assume it might have changed format also) and then inject it back into the image, which can be done without modifying the actual image data. However I don’t know if Photos will detect this or not and then strip it back off again.

Following on from this; how are you getting the photos from “Photos” into your application? The approved method from Apple is to create a “Photos” extension, whereby the user stays in “Photos”, the interface of your application and code is then executed within “Photos” like a plugin.

However this is a terrible solution as it only allows one image at a time, you don’t get the original image, only a CGImage and you don’t get any RAW data.

The solution we use (which is far from ideal) is via the Apple media selector (code is available from It produces a floating media palette in your application, to which users can drag their photos from into your application. You still don’t get RAW images (only a JPEG approximation) and I’ll be honest, I don’t know if you get the meta data or not. This is also a solution that my peers in the Photography category use.

Drag and Drop directly from “Photos” has been broken since v1.0, but the latest version gives you a small thumbnail. Took me months to understand why people were complaining that my apps were reducing the size and quality of their images, when it wasn’t, it was “Photos” giving my app a useless thumbnail.

Bug reports have gone ignored since version 1.0.

I thought about adding the photos framework to my plugins to make access to Photos database easier.

Currently we have MLMediaSourceMBS, MLMediaObjectMBS, MLMediaLibraryMBS and MLMediaGroupMBS. Those can do the databases, too, but not photos specific, but also iTunes.

And NSMediaLibraryBrowserControllerMBS can show the palette to pick something.

Thanks Sam, Yes it is SQLite. Mine is unlocked and I’ve traced through cross references to different tables to get me from the master’s filename back to the original filename and a few of the EXIF and TIFF entries from the original. I’ve not yet been able to find all the EXIF data, though it does look like Photos does save it somewhere as an Export from Photos does seem to include all the data.

Re how am I getting the data - I go to the Photos library, open the resources/derivatives subFolders named 012…F, and dig in those for the UUID named files (my app wants all of them). Then using the database translate back to the original filename, createdDate etc and add back as much of the EXIF data as possible.

An alternative route would be to use the data in the database to point at the relevant files, including referenced files.

If Christian has a better way of accessing the data that would be great.

Well, check the classes listed above and maybe that’s enough already.

Christian - thanks - the MLMediaLibraryMBS seems to access iMove and iTunes media - but not, as far as I can see, Photos.

MLMediaLibrary is deprecated as of 10.15
And there doesnt seem to be a replacement :frowning:

I guess its Apple’s way of preventing you using other Photo apps once you have used Photos for some of them.

I can put Photos framework on the todo list.
Not sure if I can do this later this year…

Thanks Christian - I’ll do a manual process until then.

[quote=460818:@Norman Palardy]MLMediaLibrary is deprecated as of 10.15
And there doesnt seem to be a replacement :([/quote]

It’s confusing, because if you go up one level and read the page here: apple says it’s for the “Mac Catalyst 13.0+” SDK - which is brand new.

So it’s both Deprecated and brand new. What does this mean in Apple-speak?

they wrote it last week so its deprecated already ?
I honestly do not know

their docs are truly a mess now
might as well just read header files for most things as the docs dont often say much

MS docs are way better in that regard