Post

Replies

Boosts

Views

Activity

I only get the thumbnail from a DNG/TIFF file
I am able to read the DNG-file as a PHAssetResource and getting the NSData through PHAssetResourceManager.requestDataForAssetResource.The NSData holds the same amount of bytes as the filesize indicates.However, when I do UIImage(data:myLoadedData) only a very low rez thumb is loaded.I have tried the following :- using CGImageSourceCreateWithData and converting it back into an UIImage via CGImageSourceCreateImageAtIndex- the CGImageSourceGetCount( imageSource) returns 1 so there is only one image in there, not counting the thumb- saving the NSData to the documents folderand reading it witn NSImage(contentsOfFile) (the saved file is a valid DNG and TIFF when I download the app package to my mac through the Device Manager)The PHAssetResource.uniformTypeIdentifier reports the file as "com.adobe.raw-image"I get the same result with DNG-files from two different cameras, both the Leica M typ240, and the Leica Monochrom (first edition)There is a difference in thumbnail size, but I am not able to view the full resolution image.Loading large jpeg's or PNGs works fine.The "app" is running on an iPad Pro iOS 9.3What am I missing here?Any tips would be greatly appreciated.Below is the code, from the UIImagePickerController returns with a selected image URL func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) { dismissViewControllerAnimated(true, completion: nil) let url = info[UIImagePickerControllerReferenceURL] as! NSURL getUIImagefromAsseturl(url) } func getUIImagefromAsseturl (url: NSURL) { let resourceManager = PHAssetResourceManager.defaultManager() let asset = PHAsset.fetchAssetsWithALAssetURLs([url], options: nil)[0] let assetResource = PHAssetResource.assetResourcesForAsset(asset as! PHAsset)[0] let totalData = NSMutableData() resourceManager.requestDataForAssetResource(assetResource, options: nil, dataReceivedHandler: { (data) in totalData.appendData( data ) print( "data.length \(data.length) \(totalData.length)" ) }, completionHandler: { (error) in if error != nil { print( "error: \(error)" ) } else { /* totalData contains the entire byte buffer from the file */ let image = UIImage(data: totalData) /* image contains puny thumbnail */ dispatch_async(dispatch_get_main_queue(), { self.imageView.contentMode = .ScaleAspectFit self.imageView.image = image }) } }) }
3
0
2.5k
Mar ’16