Add App Info To Osxphotos: A Guide To Bundle ID & Name
Have you ever wished you could retain specific metadata, like the camera app used to take a photo, when exporting from Apple Photos? This article delves into a solution for preserving valuable information such as the imported by name and bundle ID within osxphotos, ensuring a seamless transition of data, especially when integrating with applications like Lightroom Classic. Let’s explore how to make this happen.
Understanding the Challenge: Retaining Camera App Information
When exporting original photos from Apple Photos, or even when using osxphotos, certain extended attributes (xattrs) can be lost. These attributes, particularly those starting with com.apple.assetsd.*, often contain crucial information about the photo's origin, such as the camera app used. For users who rely on this data to organize and manage their photos, its loss can be a significant issue. Imagine you're trying to create smart folders in Lightroom Classic based on the camera app used, but that information is nowhere to be found! This is a common problem, particularly for those using third-party camera apps that may not consistently write their names into standard EXIF metadata.
One specific case highlights this issue perfectly: the Halide app. While many iPhone camera apps write their names into EXIF data, albeit inconsistently, Halide does not. This makes it challenging to identify photos taken with Halide within Lightroom Classic. However, Apple Photos is aware of the app used, storing this information within a series of xattrs created on the iPhone. These attributes include the creatorBundleID and importedByDisplayName, which clearly identify the app. The challenge then becomes: how can we transfer this valuable information when exporting photos?
% xattr -l /Users/gilby/Pictures/Photos\ Library.photoslibrary/originals/5/5A893AE1-FBC7-4BED-B995-5B897121EC35.heic
com.apple.assetsd.UUID: Z?:???K???[?q!?5
com.apple.assetsd.addedDate: bplist003A?NVSز?
com.apple.assetsd.assetType:
com.apple.assetsd.avalanche.type:
com.apple.assetsd.cloudAsset.UUID: 7AEE6915-13B0-4ADB-9F45-89758C58DB6A
**com.apple.assetsd.creatorBundleID: com.chromanoir.Zeit**
com.apple.assetsd.currentSleetCast:
com.apple.assetsd.customCreationDate: bplist003A?NVS?9X
com.apple.assetsd.customLocation: ?;ߘ?E?P?8Z?ib@?*k`?T@MÑ?U\@
com.apple.assetsd.dbRebuildUuid: AB81E501-B5CD-4423-B19D-2C7A59233F4D
com.apple.assetsd.deferredProcessing:
com.apple.assetsd.favorite:
com.apple.assetsd.hidden:
com.apple.assetsd.importedBy:
**com.apple.assetsd.importedByDisplayName: Halide**
com.apple.assetsd.libraryScopeAssetContributorsToUpdate: bplist00?
X$versionY$archiverT$topX$objects
com.apple.assetsd.libraryScopeShareState:
com.apple.assetsd.originalFilename: IMG_7197.HEIC
com.apple.assetsd.sceneAnalysisIsFromPreivew:
com.apple.assetsd.syndicationHistory:
com.apple.assetsd.timeZoneName: GMT+1100
com.apple.assetsd.timeZoneOffset: ??
com.apple.assetsd.trashed:
com.apple.assetsd.trashedReason:
com.apple.assetsd.videoComplementVisibility:
com.apple.assetsd.viewPresentation:
com.apple.cpl.delete: Y
com.apple.cpl.original: Y
com.apple.cscachefs: ;?%???{?僼<n?
?b@?
com.apple.lastuseddate#PS: ?9?h
com.apple.macl: @Y??1'\t@
?>??Z\tb@=+???MD?W??UO??
com.apple.quarantine: 0086;68ecabb8;com.apple.cloudd;
In the example above, you can see how the com.apple.assetsd.creatorBundleID and com.apple.assetsd.importedByDisplayName attributes clearly identify the Halide app. The question is, how do we preserve and transfer this information during export?
The Solution: Writing Attributes to Files
The core issue is how to write these crucial attributes to the exported files. Ideally, this could be achieved either by:
- Retaining the attributes as xattrs on the exported files.
- Inserting the information as EXIF metadata within the files.
The latter option, inserting as EXIF data, is generally preferred because EXIF data is more widely recognized and utilized by various applications, including Lightroom Classic. By embedding this data directly into the photo file, it ensures that the information travels with the image, regardless of the platform or software used.
How osxphotos Can Help: A Potential Implementation
osxphotos, a powerful command-line tool and Python library for interacting with Apple Photos libraries, presents a potential avenue for implementing this solution. By extending osxphotos, it may be possible to read the creatorBundleID and importedByDisplayName xattrs and write them into the EXIF metadata of exported photos. This would provide a consistent way to get camera app details into Lightroom and other photo management software.
The implementation might involve adding new options or flags to the osxphotos export command. For example, a user could specify an option to include app information, triggering the extraction of the relevant xattrs and their insertion into the EXIF data. This could be achieved by adding custom EXIF tags or by utilizing existing tags in a creative way. The key is to ensure that the information is stored in a standardized and accessible format.
A Workaround: Using Albums as Keywords
In the meantime, a workaround exists: leveraging albums in Apple Photos. By creating a smart album that contains all photos taken with a specific app (like Halide), and then configuring osxphotos to include the album name as a keyword in the EXIF metadata of exported photos, the desired information can be indirectly transferred. While this method works, it's not ideal. It requires manual setup of albums and relies on osxphotos to correctly map album names to keywords. A more direct solution, writing the app information directly into EXIF data, would be far more efficient and reliable.
Practical Steps to Implement the Solution
To implement the ideal solution, consider these steps:
- Identify the Relevant xattrs: Pinpoint the specific xattrs that contain the desired app information, such as
com.apple.assetsd.creatorBundleIDandcom.apple.assetsd.importedByDisplayName. - Extend osxphotos: Modify the osxphotos tool to read these xattrs from the photo files.
- Write to EXIF Data: Implement functionality to write the extracted information into EXIF metadata. This may involve using a library like ExifTool to manipulate the EXIF data.
- Add Export Options: Introduce new command-line options to control the inclusion of app information during export.
- Test and Refine: Thoroughly test the implementation to ensure it works correctly with various apps and photo formats.
By following these steps, osxphotos can be enhanced to become an even more powerful tool for managing and exporting photos from Apple Photos libraries.
Conclusion: Enhancing Metadata Preservation
Preserving metadata like the imported by name and bundle ID is crucial for maintaining a well-organized and searchable photo library. While workarounds exist, a direct solution that writes this information into EXIF data offers the most robust and user-friendly approach. By extending tools like osxphotos, users can ensure that valuable metadata travels with their photos, regardless of the application they use. This not only simplifies photo management but also enhances the overall experience of working with digital images. By implementing these enhancements, tools like osxphotos can significantly improve the workflow for photographers and photo enthusiasts alike, ensuring that no detail is lost in the transition from Apple Photos to other applications.
For more information on EXIF metadata and its importance in photo management, you can visit the ExifTool by Phil Harvey website.