Posts

Post not yet marked as solved
0 Replies
777 Views
I have some code to save depthData with an image from WWDC 2017 Session 508 https://developer.apple.com/videos/play/wwdc2017/508/# This code no longer works as in the depth data is not readable from the saved image file since upgrading to iOS13. For images that were saved with depth data prior to the upgrade, I can still read the depth data, though saving these files to new files with the same depth data using the same code has the same result where the depth data is no longer readable. Is there something that has changed?This is the code I am usingclass func savePortraitImage (_ outputImage: CGImage, path: String, depthData:AVDepthData, metadata:NSDictionary) -> Bool { let outputURL:URL = URL(fileURLWithPath: path) let destination = CGImageDestinationCreateWithURL(outputURL as CFURL, kUTTypeJPEG, 1, nil) CGImageDestinationAddImage(destination!, outputImage, metadata) // Add image first var auxDataType: NSString? let auxData = depthData.dictionaryRepresentation(forAuxiliaryDataType: &auxDataType) // Add auxiliary data to image destination CGImageDestinationAddAuxiliaryDataInfo(destination!, auxDataType!, auxData! as CFDictionary) // Write image file let success = CGImageDestinationFinalize(destination!) return success }
Posted
by Caevan.
Last updated
.