Photos and Imaging

RSS for tag

Integrate still images and other forms of photography into your apps.

Posts under Photos and Imaging tag

200 Posts

Post

Replies

Boosts

Views

Activity

Is there a technical reason why Photos.app/PhotoKit does not support displaying file sizes?
It is 2023 and Photos.app still provides no way to sort photos/movies by file size. I ended up writing some AppleScript that displays the file sizes of images/movies in a specific album. It is also simple to create a shell script to examine the photo library contents directly but mapping the UUID-based filenames back to the names used in Photos.app is not straightforward (to me at least). You can't even create a smart album based upon file size. Why is there no native support for this in Photos.app/PhotoKit? (And, yes, I have submitted many feature requests over the years)
0
0
595
Aug ’23
PHAsset unique identifier across devices.
I know that I can uniquely identify a PHAsset on a given device using localIdentifier but if that asset is synched (through iCloud, say) to another device, how to I uniquely identify that asset across multiple devices? My app allows users to store their images in the standard photo gallery, but I have no way of referring to them when they sync their app profile to another iOS device with my app installed.
2
0
1.3k
Aug ’23
What are the available NSSortDescriptors for PHFetchOptions?
I'm working with Apple's sample code for PhotoBrowse. In the main view controller's viewDidLoad() method we have this code: let allPhotosOptions = PHFetchOptions() allPhotosOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: true)] This code sorts the photos by "creationDate". How do I determine/find the other valid values for these sort descriptors? For example, what if I wanted to sort photos by their file size, last modified date, etc.? TIA!
2
0
959
Aug ’23
Proper way to import screen recordings with SwiftUI PhotosPicker?
Hello, I am building contact form that allows to attach screenshots and screen recordings. The PhotosPicker part is relatively straightforward but I am not sure how to properly import the selected items. The binding is of type [PhotosPickerItem] which requires (at least for my current implementation) to first know if the item is image or video. I have this not so pretty code to detect if the item is video: let isVideo = item.supportedContentTypes.first(where: { $0.conforms(to: .video) }) != nil || item.supportedContentTypes.contains(.mpeg4Movie) Which for screen recordings seems to work only because I ask about .mpeg4Movie and then I have this struct: struct ScreenRecording: Transferable { let url: URL static var transferRepresentation: some TransferRepresentation { FileRepresentation(contentType: .mpeg4Movie) { video in SentTransferredFile(video.url) } importing: { received in let copy = URL.temporaryDirectory.appending(path: "\(UUID().uuidString).mp4") try FileManager.default.copyItem(at: received.file, to: copy) return Self.init(url: copy) } } } Notice here I have just the .mpeg4Movie content type, I couldn't get it to work with more generic ones like movie and I am afraid this implementation could soon break if the screen recordings change video format/codec. And finally my logic to load the item: if isVideo { if let movie = try? await item.loadTransferable(type: ScreenRecording.self) { viewModel.addVideoAttachment(movie) } } else { if let data = try? await item.loadTransferable(type: Data.self) { if let uiImage = UIImage(data: data) { viewModel.addScreenshotAttachment(uiImage) } } } I would like to make this more "future proof" and less error prone - particularly the screen recordings part. I don't even need the UIImage since I am saving the attachments as files, I just need to know if the attachment is screenshot or video and get its URL. Thanks!
0
0
1k
Aug ’23
HEIF10 representation doesn't contain alpha channel
When using the heif10Representation and writeHEIF10Representation APIs of CIContext, the resulting image doesn’t contain an alpha channel. When using the heifRepresentation and writeHEIFRepresentation APIs, the alpha channel is properly preserved, i.e., the resulting HEIC will contain a urn:mpeg:hevc:2015:auxid:1 auxiliary image. This image is missing when exporting as HEIF10. Is this a bug or is this intentional? If I understand the spec correctly, HEIF10 should be able to support alpha via auxiliary image (like HEIF8).
1
0
1.1k
Jul ’23
Permissions when creating an album for an app and saving media
I am trying to create an album for an app in photo_kit and store images in it, is there any way to do this under the NSPhotoLibraryAddUsageDescription permission? At first glance, using NSPhotoLibraryAddUsageDescription seems to be the best choice for this app, since I will not be loading any images. However, there are two album operations that can only be done under NSPhotoLibraryUsageDescription. Creating an album Even though the creation of an album does not involve loading media, it is necessary to use NSPhotoLibraryUsageDescription to allow users to load media. This is a bit unconvincing. Saving images in the created album Before saving, you must check to see if the app has already created the album. You need to fetch the name as a key. This is where NSPhotLibraryUsageDescription is needed. I understand that the NSPhotLibraryUsageDescription is needed for fetching, but if iOS forbids the creation of albums with the same name and ignores attempts to create an album with an already existing name, this fetching will not be necessary. In summary, I just want to create an album for my app and store media in it, but in order to do so I need to get permission from the user to read into the photos, which goes against the idea that the permissions I request should be minimal and only what I need. If there is a way to do this under the NSPhotoLibraryAddUsageDescription permission I would like to know, I am new to Swift so sorry if I am wrong.
1
0
1.2k
Jul ’23
Removing image backgrounds in iOS 16 and MacOS 13
Is this accessible from Swift directly? Visual Look Up Lift subject from background Lift the subject from an image or isolate the subject by removing the background. This works in Photos, Screenshot, Quick Look, Safari, and more. Source: macOS Ventura Preview - New Features - Apple I see that Shortcuts now has a native Remove Background command that wasn't there in iOS 25 or MacOS 12. Is there any way to call that from Swift besides x-callback url schemes?
7
4
5.0k
Jun ’23
RAW photos display as if overexposed in iOS Photos and MacOS Preview
When capturing RAW (not ProRAW) photos using AVCapturePhotoOutput, the resulting images are subject to a strange overexposed effect when viewed in Apple software. I have been able to recreate this in multiple iOS apps which allow RAW capture. Some users report previously normal images transforming over the span of a few minutes. I have actually watched this happen in real-time: if you observe the camera roll after taking a few RAW photos, the highlights in some will randomly **** (edit: this just says b l o w, nice job profanity filter) out of proportion after whatever is causing this issue kicks in. The issue can also be triggered by zooming in to one of these images from the stock Photos app. Once the overexposure happens on a given image, there doesn't appear to be a way to get it to display normally again. However, if you AirDrop an image to a different device and then back, you can see it display normally at first and then break once more. Interestingly, the photo displays completely fine when viewed in Affinity photo or random photo viewers on Ubuntu. Sometimes the issue is not that bad, but it is often egregious, resulting in completely white areas of a previously balanced photo (see https://discussions.apple.com/thread/254424489). This definitely seems like a bug, but is there any way to prevent it? Could there be an issue with color profiles? This is not the same issue in which users think RAW photos are broken because they are viewing the associated JPG – this happens even with photos that have no embedded JPG or HEIC preview. Very similar (supposedly fixed) issue on MacOS: https://www.macworld.com/article/1444389/overexposed-raw-image-export-macos-monterey-photos-fixed.html Numerous similar complaints: https://discussions.apple.com/thread/254424489 https://discussions.apple.com/thread/253179308 https://discussions.apple.com/thread/253773180 https://discussions.apple.com/thread/253954972 https://discussions.apple.com/thread/252354516
3
3
3.9k
Jun ’23
My app getting rejected from testflight due to photolibraryusagedescription.
My app getting rejected from testflight due to photolibraryusagedescription when i am not even using this permission and define the purpose for this permission as per app rejection mail. BTW i am a flutter developer and my app is build in flutter. I have removed every package which might be using this permission. Done the flutter clean and pod update and everything. This is my Podfile. platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' project 'Runner', { 'Debug' => :debug, 'Profile' => :release, 'Release' => :release, } install! 'cocoapods', :disable_input_output_paths => true def flutter_root generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) unless File.exist?(generated_xcode_build_settings_path) raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end File.foreach(generated_xcode_build_settings_path) do |line| matches = line.match(/FLUTTER_ROOT\=(.*)/) return matches[1].strip if matches end raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) flutter_ios_podfile_setup # target 'Runner' do # ' # # # ... # end target 'Runner' do use_frameworks! use_modular_headers! pod 'Firebase' pod 'GoogleUtilities' # pod 'cloud_firestore', :git=> 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.3.0' pod 'Firebase/Core', '>= 0' pod 'FirebaseCrashlytics', '>= 0' flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end end installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end target 'ImageNotification' do use_frameworks! pod 'GoogleUtilities' pod 'Firebase/Messaging','>=10.0.0' end This is my Info.plist file <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>BGTaskSchedulerPermittedIdentifiers</key> <array> <string>dev.flutter.background.refresh</string> </array> <key>CADisableMinimumFrameDurationOnPhone</key> <true/> <key>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleDisplayName</key> <string>THE One</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>ios</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>$(MARKETING_VERSION)</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>fb485115409812800</string> </array> </dict> </array> <key>CFBundleVersion</key> <string>$(CURRENT_PROJECT_VERSION)</string> <key>FacebookAdvertiserIDCollectionEnabled</key> <true/> <key>FacebookAppID</key> <string>485115409812800</string> <key>FacebookAutoLogAppEventsEnabled</key> <true/> <key>FacebookClientToken</key> <string>66dae4870d542eed4c6f948fc39ce9d9</string> <key>FacebookDisplayName</key> <string>THE One Mobile App Matrid</string> <key>FirebaseAppDelegateProxyEnable</key> <false/> <key>LSApplicationCategoryType</key> <string></string> <key>LSApplicationQueriesSchemes</key> <array> <string>https</string> <string>http</string> </array> <key>LSRequiresIPhoneOS</key> <true/> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSAllowsArbitraryLoadsInWebContent</key> <true/> </dict> <key>NSLocationAlwaysUsageDescription</key> <string>This app needs access to location for selecting the products from the nearest THE One store. This will help us to deliver personalized and best products and services to you. Your data will be safe and not shared with a third party. You can disable it from Settings.</string> <key>NSLocationWhenInUseUsageDescription</key> <string>This app needs access to location for selecting the nearest THE One store. This will help us to deliver personalized and best products and services to you. Your data will be safe and not shared with a third party. You can disable it from Settings</string> <key>NSMicrophoneUsageDescription</key> <string>This app does not required Microphone permission</string> <key>NSUserTrackingUsageDescription</key> <string>This will help us to deliver personalized and best products and services to you. Your data will be safe and not shared with a third party. You can disable it from Settings</string> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>This app needs access to location for selecting the products from the nearest THE One store but this permission is optional, you can change it from app setting. This will help us to deliver personalized and best products and services to you. Your data will be safe and not shared with a third party. You can disable it from Settings.</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>This app does not required Photo Library Permission</string> <key>UIViewControllerBasedStatusBarAppearance</key> <false/> <key>io.flutter.embedded_views_preview</key> <true/> <key>UIStatusBarHidden</key> <false/> </dict> </plist> Some String has been removed from this post due to word limitation. Every help appreciated.
0
0
1.2k
Jun ’23
photoLibraryDidChange called repeatedly without any changes to Photos
I have my callback registered and it's called repeatedly without anything changing in the photo album. I'm getting the assets via PHAssetCollection.fetchAssetCollections In the callback, I update my PHFetchResult and PHCollection to the one passed in the callback. I process the changeDetails yet the callback keeps getting called. Any ideas?
1
0
642
Jun ’23
Apple Photogrammetry Multiple Sessions/Requests
I have been using the photogrammetry for some time with 1 request but I am needing to scale to multiple. For a session you must give it a folder path where the images live and then you can add multiple requests on the same set of images. My question is if I have multiple folders with different images can I batch them all together and run them at once? Right now I only see a way to set the session to Folder1's path. Folder1 - Images Folder2- Images Folder3 - Images etc Thanks!
0
0
446
May ’23
PhotosPickerItem‘s loadTransferable method has a problem with some raw format photos
item.loadTransferable(type: Data.self) { result in switch result { case .success(let data): guard let data = data, let image = UIImage(data: data) else { break } imageView.image = image case .failure(let error): ... } } I load the raw format photo through the above code, but the displayed image is very blurry and messed up. But not all raw format photos will be like this, what is the reason?
0
0
725
May ’23
How to import AVIF image in iOS by PHPicker
I use PHPicker for user to import photos, but UIImage not support the pic of .AVIF, so I want to get the origin data of .AVIF pic, this is my code: func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { picker.dismiss(animated: true) for image in results { loadImagePickerResult(image: image) } } func loadImagePickerResult(image: PHPickerResult) { if image.itemProvider.canLoadObject(ofClass: UIImage.self) { image.itemProvider.loadObject(ofClass: UIImage.self) { [weak self] newImage, error in guard let self = self else { return } if let _ = error { } else if let needAddImage = newImage as? UIImage { let imageItem = ContentImageItem() imageItem.image = needAddImage self.viewModel.selectedImageList.append(imageItem) DispatchQueue.main.async { self.scrollImageView.reloadData() self.checkConfirmState() } } } } else if image.itemProvider.hasItemConformingToTypeIdentifier(kUTTypeImage as String) { image.itemProvider.loadItem(forTypeIdentifier: kUTTypeImage as String, options: nil) { [weak self] item, error in guard let self = self else { return } guard let url = item as? URL else { return } var imageData: Data? do { imageData = try Data(contentsOf: url, options: [.mappedIfSafe, .alwaysMapped]) } catch { } guard let selectedImageData = imageData else { return } /// selectedImageData is empty data } } else { } } When I choose .AVIF pic, itemProvider can load the image by "kUTTypeImage" typeIdentifier, and success to get the local path of the pic, but when I use Data(contentsOf: ) to read the origin data, I can only get an empty data. So, is there any problem with this code?Does anyone have experience in handling this matter? "FileManager.default.contents(atPath: url.path)" and "NSData(contentsOf" is also return empty Data
1
1
1.5k
May ’23
Unable to capture Live Photo with camera using UIImagePickerController
I have been unable to capture Live Photos using UIImagePickerController. I can capture still photos and even video (which is not my scenario but I checked just to make sure), but the camera does not capture live photos. The documentation suggests it should (source): To obtain the motion and sound content of a live photo for display (using the PHLivePhotoView class), include the kUTTypeImage and kUTTypeLivePhoto identifiers in the allowed media types when configuring an image picker controller. When the user picks or captures a Live Photo, the editingInfo dictionary contains the livePhoto key, with a PHLivePhoto representation of the photo as the corresponding value. I've set up my controller: let camera = UIImagePickerController() camera.sourceType = .camera camera.mediaTypes = [UTType.image.identifier, UTType.livePhoto.identifier] camera.delegate = context.coordinator In the delegate I check for the Live Photo: func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { if let live = info[.livePhoto] as? PHLivePhoto { // handle live photo } else if let takenImage = info[.originalImage] as? UIImage, let metadata = info[.mediaMetadata] as? [AnyHashable:Any] { // handle still photo } } But I never get the Live Photo. I've tried adding NSMicrophoneUsageDescription to the info.plist thinking it needs permissions for the microphone, but that did not help. Of course, I've added the NSCameraUsageDescription to give camera permissions. Has anyone successfully captured Live Photos using UIImagePickerController?
1
1
2.0k
May ’23
Bracketed capture photos have badly clipped highlights
Bracketed photo capture with iPhone 14 Pro produces photos with oddly clipped highlights. Rather than pixel values clipping normally to white when too bright, there is a sudden and harsh jump from gray to white. See image below that shows a comparison of a normal photo capture (using qualityPriorization .speed) and a bracketed capture. Note the massive difference in clipping behavior. Here's how I am configuring the bracketed capture: let bracketedStillImageSettings = AVCaptureAutoExposureBracketedStillImageSettings.autoExposureSettings(exposureTargetBias: 0.0) let bracketSettings = AVCapturePhotoBracketSettings(rawPixelFormatType: 0 as OSType, processedFormat: [AVVideoCodecKey: AVVideoCodecType.jpeg], bracketedSettings: [bracketedStillImageSettings]) photoOutput.capturePhoto(with: bracketSettings, delegate: photoCaptureProcessor) Things I've tried that don't make a difference: Changing AVCapturePhotoBracketSettings.photoQualityPrioritization to values of .speed, .balanced, or .quality Changing device type .builtInTripleCamera, .builtInUltraWideCamera, .builtInWideCamera, .builtInDualCamera, etc Changing capture format from jpeg to hevc Any ideas?
0
0
912
May ’23
Is there a technical reason why Photos.app/PhotoKit does not support displaying file sizes?
It is 2023 and Photos.app still provides no way to sort photos/movies by file size. I ended up writing some AppleScript that displays the file sizes of images/movies in a specific album. It is also simple to create a shell script to examine the photo library contents directly but mapping the UUID-based filenames back to the names used in Photos.app is not straightforward (to me at least). You can't even create a smart album based upon file size. Why is there no native support for this in Photos.app/PhotoKit? (And, yes, I have submitted many feature requests over the years)
Replies
0
Boosts
0
Views
595
Activity
Aug ’23
PHAsset unique identifier across devices.
I know that I can uniquely identify a PHAsset on a given device using localIdentifier but if that asset is synched (through iCloud, say) to another device, how to I uniquely identify that asset across multiple devices? My app allows users to store their images in the standard photo gallery, but I have no way of referring to them when they sync their app profile to another iOS device with my app installed.
Replies
2
Boosts
0
Views
1.3k
Activity
Aug ’23
What are the available NSSortDescriptors for PHFetchOptions?
I'm working with Apple's sample code for PhotoBrowse. In the main view controller's viewDidLoad() method we have this code: let allPhotosOptions = PHFetchOptions() allPhotosOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: true)] This code sorts the photos by "creationDate". How do I determine/find the other valid values for these sort descriptors? For example, what if I wanted to sort photos by their file size, last modified date, etc.? TIA!
Replies
2
Boosts
0
Views
959
Activity
Aug ’23
Proper way to import screen recordings with SwiftUI PhotosPicker?
Hello, I am building contact form that allows to attach screenshots and screen recordings. The PhotosPicker part is relatively straightforward but I am not sure how to properly import the selected items. The binding is of type [PhotosPickerItem] which requires (at least for my current implementation) to first know if the item is image or video. I have this not so pretty code to detect if the item is video: let isVideo = item.supportedContentTypes.first(where: { $0.conforms(to: .video) }) != nil || item.supportedContentTypes.contains(.mpeg4Movie) Which for screen recordings seems to work only because I ask about .mpeg4Movie and then I have this struct: struct ScreenRecording: Transferable { let url: URL static var transferRepresentation: some TransferRepresentation { FileRepresentation(contentType: .mpeg4Movie) { video in SentTransferredFile(video.url) } importing: { received in let copy = URL.temporaryDirectory.appending(path: "\(UUID().uuidString).mp4") try FileManager.default.copyItem(at: received.file, to: copy) return Self.init(url: copy) } } } Notice here I have just the .mpeg4Movie content type, I couldn't get it to work with more generic ones like movie and I am afraid this implementation could soon break if the screen recordings change video format/codec. And finally my logic to load the item: if isVideo { if let movie = try? await item.loadTransferable(type: ScreenRecording.self) { viewModel.addVideoAttachment(movie) } } else { if let data = try? await item.loadTransferable(type: Data.self) { if let uiImage = UIImage(data: data) { viewModel.addScreenshotAttachment(uiImage) } } } I would like to make this more "future proof" and less error prone - particularly the screen recordings part. I don't even need the UIImage since I am saving the attachments as files, I just need to know if the attachment is screenshot or video and get its URL. Thanks!
Replies
0
Boosts
0
Views
1k
Activity
Aug ’23
Memory change photo order when music changes
Hi, when I try to make a memory of an album it keeps the order the photos are on in that album. However, if I change the music the order of the photos changes. Is this the expected behavior? Could we have it so that it doesn’t change the order?
Replies
1
Boosts
0
Views
790
Activity
Jul ’23
HEIF10 representation doesn't contain alpha channel
When using the heif10Representation and writeHEIF10Representation APIs of CIContext, the resulting image doesn’t contain an alpha channel. When using the heifRepresentation and writeHEIFRepresentation APIs, the alpha channel is properly preserved, i.e., the resulting HEIC will contain a urn:mpeg:hevc:2015:auxid:1 auxiliary image. This image is missing when exporting as HEIF10. Is this a bug or is this intentional? If I understand the spec correctly, HEIF10 should be able to support alpha via auxiliary image (like HEIF8).
Replies
1
Boosts
0
Views
1.1k
Activity
Jul ’23
Permissions when creating an album for an app and saving media
I am trying to create an album for an app in photo_kit and store images in it, is there any way to do this under the NSPhotoLibraryAddUsageDescription permission? At first glance, using NSPhotoLibraryAddUsageDescription seems to be the best choice for this app, since I will not be loading any images. However, there are two album operations that can only be done under NSPhotoLibraryUsageDescription. Creating an album Even though the creation of an album does not involve loading media, it is necessary to use NSPhotoLibraryUsageDescription to allow users to load media. This is a bit unconvincing. Saving images in the created album Before saving, you must check to see if the app has already created the album. You need to fetch the name as a key. This is where NSPhotLibraryUsageDescription is needed. I understand that the NSPhotLibraryUsageDescription is needed for fetching, but if iOS forbids the creation of albums with the same name and ignores attempts to create an album with an already existing name, this fetching will not be necessary. In summary, I just want to create an album for my app and store media in it, but in order to do so I need to get permission from the user to read into the photos, which goes against the idea that the permissions I request should be minimal and only what I need. If there is a way to do this under the NSPhotoLibraryAddUsageDescription permission I would like to know, I am new to Swift so sorry if I am wrong.
Replies
1
Boosts
0
Views
1.2k
Activity
Jul ’23
HLG or PQ transfer type for 10 bit heif
I understand that Apple fully implemented the ITU-R BT.2100 PQ and HLG transfer types for various image formats. I’m working on a project where I have a dng file as an input and I need to save the modified file as heif. Which transfer method should I choose? Does it matter?
Replies
1
Boosts
0
Views
1.7k
Activity
Jun ’23
why the photos taken using iphone 14 plus from a distance of 20 meter is unable to get clear vehicle license number
I was trying to take an image of a car that includes the license plate. But later when I checked the numbers in the license plate is not clear and readable. When I did a zoom there are slanting lines in place. Is there any settings available to avoid?
Replies
1
Boosts
0
Views
965
Activity
Jun ’23
Removing image backgrounds in iOS 16 and MacOS 13
Is this accessible from Swift directly? Visual Look Up Lift subject from background Lift the subject from an image or isolate the subject by removing the background. This works in Photos, Screenshot, Quick Look, Safari, and more. Source: macOS Ventura Preview - New Features - Apple I see that Shortcuts now has a native Remove Background command that wasn't there in iOS 25 or MacOS 12. Is there any way to call that from Swift besides x-callback url schemes?
Replies
7
Boosts
4
Views
5.0k
Activity
Jun ’23
RAW photos display as if overexposed in iOS Photos and MacOS Preview
When capturing RAW (not ProRAW) photos using AVCapturePhotoOutput, the resulting images are subject to a strange overexposed effect when viewed in Apple software. I have been able to recreate this in multiple iOS apps which allow RAW capture. Some users report previously normal images transforming over the span of a few minutes. I have actually watched this happen in real-time: if you observe the camera roll after taking a few RAW photos, the highlights in some will randomly **** (edit: this just says b l o w, nice job profanity filter) out of proportion after whatever is causing this issue kicks in. The issue can also be triggered by zooming in to one of these images from the stock Photos app. Once the overexposure happens on a given image, there doesn't appear to be a way to get it to display normally again. However, if you AirDrop an image to a different device and then back, you can see it display normally at first and then break once more. Interestingly, the photo displays completely fine when viewed in Affinity photo or random photo viewers on Ubuntu. Sometimes the issue is not that bad, but it is often egregious, resulting in completely white areas of a previously balanced photo (see https://discussions.apple.com/thread/254424489). This definitely seems like a bug, but is there any way to prevent it? Could there be an issue with color profiles? This is not the same issue in which users think RAW photos are broken because they are viewing the associated JPG – this happens even with photos that have no embedded JPG or HEIC preview. Very similar (supposedly fixed) issue on MacOS: https://www.macworld.com/article/1444389/overexposed-raw-image-export-macos-monterey-photos-fixed.html Numerous similar complaints: https://discussions.apple.com/thread/254424489 https://discussions.apple.com/thread/253179308 https://discussions.apple.com/thread/253773180 https://discussions.apple.com/thread/253954972 https://discussions.apple.com/thread/252354516
Replies
3
Boosts
3
Views
3.9k
Activity
Jun ’23
Is there an API for access photos shared albumn?
Since iOS16 introduced the shared albumn, is there an API for developers to access the assets inside that shared albumn?
Replies
5
Boosts
1
Views
3.9k
Activity
Jun ’23
My app getting rejected from testflight due to photolibraryusagedescription.
My app getting rejected from testflight due to photolibraryusagedescription when i am not even using this permission and define the purpose for this permission as per app rejection mail. BTW i am a flutter developer and my app is build in flutter. I have removed every package which might be using this permission. Done the flutter clean and pod update and everything. This is my Podfile. platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' project 'Runner', { 'Debug' => :debug, 'Profile' => :release, 'Release' => :release, } install! 'cocoapods', :disable_input_output_paths => true def flutter_root generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) unless File.exist?(generated_xcode_build_settings_path) raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end File.foreach(generated_xcode_build_settings_path) do |line| matches = line.match(/FLUTTER_ROOT\=(.*)/) return matches[1].strip if matches end raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) flutter_ios_podfile_setup # target 'Runner' do # ' # # # ... # end target 'Runner' do use_frameworks! use_modular_headers! pod 'Firebase' pod 'GoogleUtilities' # pod 'cloud_firestore', :git=> 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.3.0' pod 'Firebase/Core', '>= 0' pod 'FirebaseCrashlytics', '>= 0' flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end end installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end target 'ImageNotification' do use_frameworks! pod 'GoogleUtilities' pod 'Firebase/Messaging','>=10.0.0' end This is my Info.plist file <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>BGTaskSchedulerPermittedIdentifiers</key> <array> <string>dev.flutter.background.refresh</string> </array> <key>CADisableMinimumFrameDurationOnPhone</key> <true/> <key>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleDisplayName</key> <string>THE One</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>ios</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>$(MARKETING_VERSION)</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>fb485115409812800</string> </array> </dict> </array> <key>CFBundleVersion</key> <string>$(CURRENT_PROJECT_VERSION)</string> <key>FacebookAdvertiserIDCollectionEnabled</key> <true/> <key>FacebookAppID</key> <string>485115409812800</string> <key>FacebookAutoLogAppEventsEnabled</key> <true/> <key>FacebookClientToken</key> <string>66dae4870d542eed4c6f948fc39ce9d9</string> <key>FacebookDisplayName</key> <string>THE One Mobile App Matrid</string> <key>FirebaseAppDelegateProxyEnable</key> <false/> <key>LSApplicationCategoryType</key> <string></string> <key>LSApplicationQueriesSchemes</key> <array> <string>https</string> <string>http</string> </array> <key>LSRequiresIPhoneOS</key> <true/> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSAllowsArbitraryLoadsInWebContent</key> <true/> </dict> <key>NSLocationAlwaysUsageDescription</key> <string>This app needs access to location for selecting the products from the nearest THE One store. This will help us to deliver personalized and best products and services to you. Your data will be safe and not shared with a third party. You can disable it from Settings.</string> <key>NSLocationWhenInUseUsageDescription</key> <string>This app needs access to location for selecting the nearest THE One store. This will help us to deliver personalized and best products and services to you. Your data will be safe and not shared with a third party. You can disable it from Settings</string> <key>NSMicrophoneUsageDescription</key> <string>This app does not required Microphone permission</string> <key>NSUserTrackingUsageDescription</key> <string>This will help us to deliver personalized and best products and services to you. Your data will be safe and not shared with a third party. You can disable it from Settings</string> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>This app needs access to location for selecting the products from the nearest THE One store but this permission is optional, you can change it from app setting. This will help us to deliver personalized and best products and services to you. Your data will be safe and not shared with a third party. You can disable it from Settings.</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>This app does not required Photo Library Permission</string> <key>UIViewControllerBasedStatusBarAppearance</key> <false/> <key>io.flutter.embedded_views_preview</key> <true/> <key>UIStatusBarHidden</key> <false/> </dict> </plist> Some String has been removed from this post due to word limitation. Every help appreciated.
Replies
0
Boosts
0
Views
1.2k
Activity
Jun ’23
photoLibraryDidChange called repeatedly without any changes to Photos
I have my callback registered and it's called repeatedly without anything changing in the photo album. I'm getting the assets via PHAssetCollection.fetchAssetCollections In the callback, I update my PHFetchResult and PHCollection to the one passed in the callback. I process the changeDetails yet the callback keeps getting called. Any ideas?
Replies
1
Boosts
0
Views
642
Activity
Jun ’23
Apple Photogrammetry Multiple Sessions/Requests
I have been using the photogrammetry for some time with 1 request but I am needing to scale to multiple. For a session you must give it a folder path where the images live and then you can add multiple requests on the same set of images. My question is if I have multiple folders with different images can I batch them all together and run them at once? Right now I only see a way to set the session to Folder1's path. Folder1 - Images Folder2- Images Folder3 - Images etc Thanks!
Replies
0
Boosts
0
Views
446
Activity
May ’23
PhotosPickerItem‘s loadTransferable method has a problem with some raw format photos
item.loadTransferable(type: Data.self) { result in switch result { case .success(let data): guard let data = data, let image = UIImage(data: data) else { break } imageView.image = image case .failure(let error): ... } } I load the raw format photo through the above code, but the displayed image is very blurry and messed up. But not all raw format photos will be like this, what is the reason?
Replies
0
Boosts
0
Views
725
Activity
May ’23
How to import AVIF image in iOS by PHPicker
I use PHPicker for user to import photos, but UIImage not support the pic of .AVIF, so I want to get the origin data of .AVIF pic, this is my code: func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { picker.dismiss(animated: true) for image in results { loadImagePickerResult(image: image) } } func loadImagePickerResult(image: PHPickerResult) { if image.itemProvider.canLoadObject(ofClass: UIImage.self) { image.itemProvider.loadObject(ofClass: UIImage.self) { [weak self] newImage, error in guard let self = self else { return } if let _ = error { } else if let needAddImage = newImage as? UIImage { let imageItem = ContentImageItem() imageItem.image = needAddImage self.viewModel.selectedImageList.append(imageItem) DispatchQueue.main.async { self.scrollImageView.reloadData() self.checkConfirmState() } } } } else if image.itemProvider.hasItemConformingToTypeIdentifier(kUTTypeImage as String) { image.itemProvider.loadItem(forTypeIdentifier: kUTTypeImage as String, options: nil) { [weak self] item, error in guard let self = self else { return } guard let url = item as? URL else { return } var imageData: Data? do { imageData = try Data(contentsOf: url, options: [.mappedIfSafe, .alwaysMapped]) } catch { } guard let selectedImageData = imageData else { return } /// selectedImageData is empty data } } else { } } When I choose .AVIF pic, itemProvider can load the image by "kUTTypeImage" typeIdentifier, and success to get the local path of the pic, but when I use Data(contentsOf: ) to read the origin data, I can only get an empty data. So, is there any problem with this code?Does anyone have experience in handling this matter? "FileManager.default.contents(atPath: url.path)" and "NSData(contentsOf" is also return empty Data
Replies
1
Boosts
1
Views
1.5k
Activity
May ’23
Unable to capture Live Photo with camera using UIImagePickerController
I have been unable to capture Live Photos using UIImagePickerController. I can capture still photos and even video (which is not my scenario but I checked just to make sure), but the camera does not capture live photos. The documentation suggests it should (source): To obtain the motion and sound content of a live photo for display (using the PHLivePhotoView class), include the kUTTypeImage and kUTTypeLivePhoto identifiers in the allowed media types when configuring an image picker controller. When the user picks or captures a Live Photo, the editingInfo dictionary contains the livePhoto key, with a PHLivePhoto representation of the photo as the corresponding value. I've set up my controller: let camera = UIImagePickerController() camera.sourceType = .camera camera.mediaTypes = [UTType.image.identifier, UTType.livePhoto.identifier] camera.delegate = context.coordinator In the delegate I check for the Live Photo: func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { if let live = info[.livePhoto] as? PHLivePhoto { // handle live photo } else if let takenImage = info[.originalImage] as? UIImage, let metadata = info[.mediaMetadata] as? [AnyHashable:Any] { // handle still photo } } But I never get the Live Photo. I've tried adding NSMicrophoneUsageDescription to the info.plist thinking it needs permissions for the microphone, but that did not help. Of course, I've added the NSCameraUsageDescription to give camera permissions. Has anyone successfully captured Live Photos using UIImagePickerController?
Replies
1
Boosts
1
Views
2.0k
Activity
May ’23
Can't save gifs anymore ios 14?
Can't save gifs, it just saves frame of it as a photo.
Replies
100
Boosts
1
Views
94k
Activity
May ’23
Bracketed capture photos have badly clipped highlights
Bracketed photo capture with iPhone 14 Pro produces photos with oddly clipped highlights. Rather than pixel values clipping normally to white when too bright, there is a sudden and harsh jump from gray to white. See image below that shows a comparison of a normal photo capture (using qualityPriorization .speed) and a bracketed capture. Note the massive difference in clipping behavior. Here's how I am configuring the bracketed capture: let bracketedStillImageSettings = AVCaptureAutoExposureBracketedStillImageSettings.autoExposureSettings(exposureTargetBias: 0.0) let bracketSettings = AVCapturePhotoBracketSettings(rawPixelFormatType: 0 as OSType, processedFormat: [AVVideoCodecKey: AVVideoCodecType.jpeg], bracketedSettings: [bracketedStillImageSettings]) photoOutput.capturePhoto(with: bracketSettings, delegate: photoCaptureProcessor) Things I've tried that don't make a difference: Changing AVCapturePhotoBracketSettings.photoQualityPrioritization to values of .speed, .balanced, or .quality Changing device type .builtInTripleCamera, .builtInUltraWideCamera, .builtInWideCamera, .builtInDualCamera, etc Changing capture format from jpeg to hevc Any ideas?
Replies
0
Boosts
0
Views
912
Activity
May ’23