JUST ENDED
|

Photos & Camera Q&A

Connect with Apple engineers in the Photos & Camera Q&A on the Apple Developer Forums.

Post

Replies

Boosts

Views

Activity

Restore certain photo resources
Through the Photos framework, we can access (and thus backup) resources the user created in Photos, such as Adjustments.plist, AdjustmentsSecondary.data, .aae files and more. Is there any way to restore those resources back into the Photos library? (e.g., similar to dropping a combination of .heic and .mov file to restore a Live Photo)
1
2
66
5h
PHAssetResource.originalFilename can be nil despite non-optional Swift API
In our PhotoKit backup/export code, we need to read PHAssetResource.originalFilename for each resource. The Swift API imports this property as non-optional: var originalFilename: String { get } However, we have customer reports from real Photos libraries where reading this property appears to crash because the underlying Objective-C value is nil at runtime. This affects actual users of our shipping app, not just a synthetic test case. The relevant code path is essentially this: import Photos func inspectAsset(_ asset: PHAsset) { let resources = PHAssetResource.assetResources(for: asset) for resource in resources { // This property is imported as non-optional String. // For some affected customer assets, reading it appears to trap/crash // because the underlying value is nil. let filename: String = resource.originalFilename print(filename) } } This makes the API difficult to use safely from Swift: because the property is non-optional, there is no normal Swift optional-handling path before the crash. We filed this as FB22589474. We also filed a related Feedback, FB22519412, for empty-string / otherwise unusable filename values. That is a separate issue, but it points in the same direction: apps that export, back up, or sync Photos resources cannot treat PHAssetResource.originalFilename as a guaranteed usable filename. For PHAssetResource.originalFilename, what is the intended contract?
3
0
75
13h
PHObject.localIdentifier reliability
For a PHAsset in the same Photos library on the same device/Mac, what are the documented stability guarantees of PHObject.localIdentifier? Is it safe to persist and use for future PhotoKit operations in that same local library? Are there known cases where it can change or stop resolving? If a persisted localIdentifier no longer resolves but a persisted PHCloudIdentifier.archivalStringValue does resolve in the same library, is updating the stored local identifier from that cloud mapping the recommended recovery path? Thanks!
3
1
91
1d
Local PHAssetResource availability
Is there a way to determine whether a specific PHAssetResource original is locally available/downloaded without requesting it? If not, is the recommended approach to request the resource with PHAssetResourceRequestOptions.isNetworkAccessAllowed = false and handle networkAccessRequired error? Is that error the definitive signal that the requested resource is not locally available, or are there other errors that should be treated the same way? Thanks!
1
1
43
1d
Smooth transition between cameras
In Apple's Camera app (set to "Photo" mode), when the system switches between different cameras, the transition is incredibly smooth. In particular, when getting too close to an object for the wide angle camera (due to the minimal focus distance), it automatically switches to the ultra-wide angle. When switching, the app transitions between the cameras very smoothly, by which I mean the position of the object in frame doesn't shift despite the physical location of the cameras being different. Is it possible to replicate this behaviour with the AVFoundation API? When creating a AVCaptureSession using a AVCaptureDevice with the builtInTripleCamera device type, the session automatically switches between the constituent cameras as expected. However, unlike Apple's Camera app, there is a very noticeable shift in perspective when switching. This is especially noticeable when switching between the WA and UWA cameras while zoomed in, sometimes resulting in the center of the frame being shifted all the way to the edge of the screen. I was able to somewhat replicate the smooth switching by setting activeVideoStabilizationMode of my AVCaptureConnection (with AVCaptureVideoDataOutput) to .cinematic, but this would introduce too much delay for a live preview, and none of the other available stabilization modes seemed to support this smooth transitioning. Is it possible to replicate the behaviour of the Camera app using the AVFoundation API?
2
0
89
1d
Feature request: Linear scene-referred preview for Bayer RAW capture
I would like to request a linear scene-referred preview stream for Bayer RAW workflows via AVCaptureVideoDataOutput or AVCaptureVideoPreviewLayer, without tone mapping, computational processing, or a baked-in rendered look. This is particularly important for third-party camera apps built around Bayer RAW workflows, including my app, Lampa Camera. In other words, it would be great to have a preview mode that closely matches the CIRAWFilter output for a Bayer DNG with the following configuration: rawFilter.baselineExposure = 0.0 rawFilter.shadowBias = 0.0 rawFilter.boostAmount = 0.0 rawFilter.localToneMapAmount = 0.0 Currently, the live preview comes from the processed camera feed. As a result, the viewfinder can differ noticeably from the final RAW-converted image in exposure, dynamic range, contrast, and sharpness. A Bayer RAW-compatible linear preview mode would make it possible to provide a reliable what-you-see-is-what-you-get shooting experience for RAW-based camera apps. Would Apple consider exposing such a preview mode in AVFoundation? Related Feedback Assistant report: FB22660803
3
1
101
1d
Portrait flag detection
PHAsset.mediaSubtypes.contains(.photoDepthEffect) exposes the portrait/depth-effect flag through PhotoKit. Is there a way to detect the same Photos “Portrait” classification when reading the image file directly using ImageIO? I've found that key 25 in kCGImagePropertyMakerAppleDictionary appears to correlate with the Portrait flag. Is the existence of this key a stable signal for that classification, or should I use another ImageIO signal? Thanks!
1
0
33
1d
Restore certain photo resources
Through the Photos framework, we can access (and thus backup) resources the user created in Photos, such as Adjustments.plist, AdjustmentsSecondary.data, .aae files and more. Is there any way to restore those resources back into the Photos library? (e.g., similar to dropping a combination of .heic and .mov file to restore a Live Photo)
Replies
1
Boosts
2
Views
66
Activity
5h
PHAssetResource.originalFilename can be nil despite non-optional Swift API
In our PhotoKit backup/export code, we need to read PHAssetResource.originalFilename for each resource. The Swift API imports this property as non-optional: var originalFilename: String { get } However, we have customer reports from real Photos libraries where reading this property appears to crash because the underlying Objective-C value is nil at runtime. This affects actual users of our shipping app, not just a synthetic test case. The relevant code path is essentially this: import Photos func inspectAsset(_ asset: PHAsset) { let resources = PHAssetResource.assetResources(for: asset) for resource in resources { // This property is imported as non-optional String. // For some affected customer assets, reading it appears to trap/crash // because the underlying value is nil. let filename: String = resource.originalFilename print(filename) } } This makes the API difficult to use safely from Swift: because the property is non-optional, there is no normal Swift optional-handling path before the crash. We filed this as FB22589474. We also filed a related Feedback, FB22519412, for empty-string / otherwise unusable filename values. That is a separate issue, but it points in the same direction: apps that export, back up, or sync Photos resources cannot treat PHAssetResource.originalFilename as a guaranteed usable filename. For PHAssetResource.originalFilename, what is the intended contract?
Replies
3
Boosts
0
Views
75
Activity
13h
15 minutes to go
Thanks for your great questions. We'll be wrapping up our live feedback session in 15 minutes. Please get your questions in soon.
Replies
0
Boosts
0
Views
20
Activity
1d
PHPhotoLibraryPersistentChangesObserver description
What is the intended purpose of the new PHPhotoLibraryPersistentChangesObserver? I currently use PHPhotoLibraryChangeObserver as a trigger, then call fetchPersistentChanges(since:). What behavior or guarantees differ when using PHPhotoLibraryPersistentChangesObserver instead? Thanks!
Replies
3
Boosts
0
Views
61
Activity
1d
PHObject.localIdentifier reliability
For a PHAsset in the same Photos library on the same device/Mac, what are the documented stability guarantees of PHObject.localIdentifier? Is it safe to persist and use for future PhotoKit operations in that same local library? Are there known cases where it can change or stop resolving? If a persisted localIdentifier no longer resolves but a persisted PHCloudIdentifier.archivalStringValue does resolve in the same library, is updating the stored local identifier from that cloud mapping the recommended recovery path? Thanks!
Replies
3
Boosts
1
Views
91
Activity
1d
Deep link to PHAsset in Photos app?
My app displays photos from user's photo library. I want to provide a way to deep link to that photo in the Photos app (open the photo in the Photos app). Is there any way to do this?
Replies
4
Boosts
2
Views
104
Activity
1d
Testing and purging optimized-storage assets
Is there a supported way for developers to purge locally downloaded Photos originals/resources in order to force an asset/resource into a non-downloaded iCloud-only state? Basically simulate "Optimize Mac Storage" behavior on demand for testing. Thanks!
Replies
1
Boosts
0
Views
30
Activity
1d
Local PHAssetResource availability
Is there a way to determine whether a specific PHAssetResource original is locally available/downloaded without requesting it? If not, is the recommended approach to request the resource with PHAssetResourceRequestOptions.isNetworkAccessAllowed = false and handle networkAccessRequired error? Is that error the definitive signal that the requested resource is not locally available, or are there other errors that should be treated the same way? Thanks!
Replies
1
Boosts
1
Views
43
Activity
1d
Identifying Personal vs. Shared Library Assets in Photos.framework
Can Photos.framework distinguish between assets that are stored in the user’s Personal Library and assets that are stored in the Shared Library? If not, is there a planned API that would allow developers to identify the library membership of a PHAsset?
Replies
3
Boosts
0
Views
66
Activity
1d
Smooth transition between cameras
In Apple's Camera app (set to "Photo" mode), when the system switches between different cameras, the transition is incredibly smooth. In particular, when getting too close to an object for the wide angle camera (due to the minimal focus distance), it automatically switches to the ultra-wide angle. When switching, the app transitions between the cameras very smoothly, by which I mean the position of the object in frame doesn't shift despite the physical location of the cameras being different. Is it possible to replicate this behaviour with the AVFoundation API? When creating a AVCaptureSession using a AVCaptureDevice with the builtInTripleCamera device type, the session automatically switches between the constituent cameras as expected. However, unlike Apple's Camera app, there is a very noticeable shift in perspective when switching. This is especially noticeable when switching between the WA and UWA cameras while zoomed in, sometimes resulting in the center of the frame being shifted all the way to the edge of the screen. I was able to somewhat replicate the smooth switching by setting activeVideoStabilizationMode of my AVCaptureConnection (with AVCaptureVideoDataOutput) to .cinematic, but this would introduce too much delay for a live preview, and none of the other available stabilization modes seemed to support this smooth transitioning. Is it possible to replicate the behaviour of the Camera app using the AVFoundation API?
Replies
2
Boosts
0
Views
89
Activity
1d
Feature request: Linear scene-referred preview for Bayer RAW capture
I would like to request a linear scene-referred preview stream for Bayer RAW workflows via AVCaptureVideoDataOutput or AVCaptureVideoPreviewLayer, without tone mapping, computational processing, or a baked-in rendered look. This is particularly important for third-party camera apps built around Bayer RAW workflows, including my app, Lampa Camera. In other words, it would be great to have a preview mode that closely matches the CIRAWFilter output for a Bayer DNG with the following configuration: rawFilter.baselineExposure = 0.0 rawFilter.shadowBias = 0.0 rawFilter.boostAmount = 0.0 rawFilter.localToneMapAmount = 0.0 Currently, the live preview comes from the processed camera feed. As a result, the viewfinder can differ noticeably from the final RAW-converted image in exposure, dynamic range, contrast, and sharpness. A Bayer RAW-compatible linear preview mode would make it possible to provide a reliable what-you-see-is-what-you-get shooting experience for RAW-based camera apps. Would Apple consider exposing such a preview mode in AVFoundation? Related Feedback Assistant report: FB22660803
Replies
3
Boosts
1
Views
101
Activity
1d
Portrait flag detection
PHAsset.mediaSubtypes.contains(.photoDepthEffect) exposes the portrait/depth-effect flag through PhotoKit. Is there a way to detect the same Photos “Portrait” classification when reading the image file directly using ImageIO? I've found that key 25 in kCGImagePropertyMakerAppleDictionary appears to correlate with the Portrait flag. Is the existence of this key a stable signal for that classification, or should I use another ImageIO signal? Thanks!
Replies
1
Boosts
0
Views
33
Activity
1d