-1

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.

Jeshua Lacock
  • 5,730
  • 1
  • 28
  • 58
  • To whomever voted to have this closed: I am asking a single question. I updated the post with my findings trying to solve the question a different way that I originally posted, but the came to a dead end. Regardless, it was trying to anwer my single question which is of-course, how do I "Copy written billion+ pixel image to Photos?" – Jeshua Lacock Jul 28 '22 at 05:24

1 Answers1

0

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

Mattheus
  • 16
  • 1