My app is successfully writing multi-gigapixel images (many billions of pixels per image).
Is there a way, without reading the image as a UIImage
, to add or copy the saved image to Photos?
It's difficult to search for the subject to find a solution that does not require UIImageWriteToSavedPhotosAlbum
.
The issue is that the saved image is too large to load as a UIImage
so I can't use UIImageWriteToSavedPhotosAlbum
.
Edit: It appears that this can be done with PhotoKit
. Can someone point me to an example of creating PHAsset
from a saved image file? I'm currently searching.
Edit 2: Hmm seems like it is only possible to modify an existing PHAsset
(eg an item that already exists in Photos). Which I guess would be a dead end if that is the case.
You certainly can create a new asset from a file and insert it into the user's PhotoLibrary. Take a look at [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL]
and the related docs:
https://developer.apple.com/documentation/photokit/phassetchangerequest/1624059-creationrequestforassetfromimage?language=objc
https://developer.apple.com/documentation/photokit/phassetcreationrequest?language=objc#1656303