RhetTbull / osxphotos

Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
MIT License
2.04k stars 95 forks source link

Export modifications as well? #150

Open mccarverone opened 4 years ago

mccarverone commented 4 years ago

Hello thank you very much for your awesome work on this project.

I am trying to understand the best possible way to export my library from Photos while keeping 100% information pertaining to the media files. My objective is to have the original media file exported with all the relevant details in a separate sidecar file.

One missing piece of the puzzle would be the possibility to export the basic information about image CROP editing, which are provided as fields at least in XMP metadata format.

https://www.exiv2.org/tags-xmp-crs.html

What do you think? Is this information easily discoverable from Photos db?

Thanks, Riccardo

RhetTbull commented 4 years ago

I've not been able to reverse engineer the photo adjustments. I've not spent considerable time on this but have looked at the database and tried to understand how adjustments were being stored--unfortunately the information on adjustments is not straight forward.

osxphotos does export the modified jpeg image but it is not able to decode the adjustment history (for example, crop, filter, adjust lighting, etc). If I can eventually figure out how decode this information I'll certainly add an interface to it.

mccarverone commented 4 years ago

I sort of expected this. Thanks for your reply. Kind regards

neilpa commented 4 years ago

Could re-open this now based on the progress in https://github.com/RhetTbull/osxphotos/issues/215#issuecomment-698663130. Would also keep that issue focused on RAW conversion and could further discuss how to handle adjustment data here.

RhetTbull commented 3 years ago

@mccarverone Thanks to some amazing sleuthing by @neilpa , I'll now be able to extract the adjustments/edits from Photos. I'll add the ability to extract basic information about the adjustments. For crop info, what would the use case be for putting these in the XMP sidecar? I assume you'd want the crop information in XMP tags for the original file (because the edited file is already cropped)?

RhetTbull commented 3 years ago

Crop data looks like this:

{'adjustments': [{'enabled': True,
                  'formatVersion': 1,
                  'identifier': 'RKRawDecodeOperation',
                  'settings': {'DGOperationClassName': 'DGRawDecodeOperation',
                               'DGOperationDisplayName': 'RAW Fine Tuning',
                               'DGOperationIdentifier': 'RKRawDecodeOperation',
                               'enabled': True,
                               'inputKeys': {'inputMethodVersion': '8'}}},
                 {'enabled': True,
                  'formatVersion': 1,
                  'identifier': 'Crop',
                  'settings': {'constraintHeight': 0,
                               'constraintWidth': 0,
                               'height': 2992,
                               'straightenAngle': 0,
                               'width': 3584,
                               'xOrigin': 448,
                               'yOrigin': 0}}],
 'formatVersion': 1,
 'metadata': {'masterHeight': 3024,
              'masterWidth': 4032,
              'orientation': 6,
              'pipelineVersion': 'OSX.4'},
 'versionInfo': {'appVersion': '311.0.130',
                 'buildNumber': '20B28',
                 'platform': 'OSX',
                 'schemaRevision': 1}}
mccarverone commented 3 years ago

That is exactly right. Use case is to find the same adjustments when importing the untouched original photo and its XMP in a different software. I hope that these metadata are sufficiently widespread to allow this. Thanks for your efforts.

RhetTbull commented 3 years ago

I think I might be able to get the crop data into the XMP but I'm not hopeful on much of the edits beyond that. All the other edits would be filters or other changes that wouldn't translate from Photos to another program.