kCGImageSourceDecodeToHDR and CGImageSourceCopyPropertiesAtIndex

Hi,

I'm using Core Graphics to load a .DNG photo shot by a Leica Q3 camera. The photo is shot in portrait, however the embedded preview is rotated 90 degrees to landscape.

I load the photo like this:

let options = [kCGImageSourceDecodeRequest: kCGImageSourceDecodeToHDR] as CFDictionary

let source = CGImageSourceCreateWithData(data as CFData, nil)

let cgimage = CGImageSourceCreateImageAtIndex(source, 0, options)

let properties = CGImageSourceCopyPropertiesAtIndex(source, 0, nil) as? [CFString : Any]

When doing this I can see that the orientation property is 1 indicating that the orientation is 'Up', which it isn't.

If I don't specify the kCGImageSourceDecodeToHDR option (eseentially setting options to nil) - the orientation property is 8 (rotated 90 degrees).

What puzzles me is that a chang to the CGImageSourceCreateImageAtIndex call can have an influence on that latter call to CGImageSourceCopyPropertiesAtIndex ?

I would expect these to work independently?

Cheers Thomas

Answered by DTS Engineer in 826115022

Interesting question. Going by the documentation and the discussion of HDR images in our WWDC lectures I expect you should be seeing the same properties. It's possible the SDR query is using the thumbnail instead of the HDR content in the file.

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the FB number here once you do. I'll circle back, check the status, and see what the engineering team has to say about it.

Bug Reporting: How and Why? has tips on creating your bug report.

Interesting question. Going by the documentation and the discussion of HDR images in our WWDC lectures I expect you should be seeing the same properties. It's possible the SDR query is using the thumbnail instead of the HDR content in the file.

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the FB number here once you do. I'll circle back, check the status, and see what the engineering team has to say about it.

Bug Reporting: How and Why? has tips on creating your bug report.

kCGImageSourceDecodeToHDR and CGImageSourceCopyPropertiesAtIndex
 
 
Q