Metapho and Photos Asset
Safety over efficiency
The stock Photos app for iOS lets third party apps modify photos in its library since iOS 8. Metapho uses this PhotoKit API and the first rule of modifying asset is No one is messing with the original asset. The original file itself is untouchable for a third party app. Even Photos does not change it when you edit an item in Edit menu.
Instead of overwriting original files, PhotoKit asks an app for edited version of the file and saves it in addition to the original as one bundle. This takes more storage space than editing original directly, but helps users to revert to the original state even after numerous edits are committed by Photos or third party apps.
Under this constraint, it is not possible to just modify metadata part of an image file in your library. Metapho has to make a whole new image with modified metadata and give it to PhotoKit. In this process, PhotoKit only accepts image file in specific format. It is very picky on saving edited version. It has to be JPEG with baked-in orientation. For this reason, when you edit metadata with Metapho, the app rotates and re-renders image, if it does not have top-left orientation.
PhotoKit and metadata
When you take a photo or import one, Photos adds creation date and location metadata of the photo to its own metadata database. While this makes it easy to access and modify these metadata, it also makes it possible to have two different set of metadata in Photos database and the image file.
For example, when some app—including Photos for macOS—removes location of a photo, it edits the PhotoKit’s own metadata only, and creates location removed image file on the fly when you export it within the app. If you share the photo with other app like Photos for iOS, it will provide unmodified original image that has location data in it.
Metapho can detect location metadata conflict and show a warning like this.
⚠️ This location is marked as removed. To remove location from metadata, tap Edit > “Remove Location” button.
If you’ve removed location with Metapho, it’s hard to accidentally share location tagged image, via Metapho or other apps. Since the app changes PhotoKit’s database and makes an edited version of the image without location metadata.
Rewrite Date Tags option
I thought that the creation date is less sensitive metadata than location, so I added “Rewrite Date Tags” option. If the option in Date Edit screen is turned off, Metapho behaves like Photos for mac, does not create a new image with edited date tag, and just adjusts metadata managed by PhotoKit.