Heureka! I have found it! The missing link was the method fileURLWithPath
!
Apart from that I am not caching and also using the create options dictionary for the image retrieval.
This is actually working:
if ([self pathLastRawDataSave])
{
NSURL* imageFileURL = [NSURL fileURLWithPath:[self pathLastRawDataSave]];
CFURLRef imageFileURLRef = (__bridge CFURLRef)imageFileURL; // bridged from NS-Object, no release!
NSDictionary* sourceOptions = @{(id)kCGImageSourceShouldCache: (id)kCFBooleanFalse,
(id)kCGImageSourceTypeIdentifierHint: (id)kUTTypeTIFF};
CFDictionaryRef sourceOptionsRef = (__bridge CFDictionaryRef)sourceOptions; // bridged from NS-Object, no release!
CGImageSourceRef imageSource = CGImageSourceCreateWithURL(imageFileURLRef, sourceOptionsRef);
if (NULL != imageSource)
{
// create the image from the file
CGImageRef imageData = CGImageSourceCreateImageAtIndex(imageSource, 0, sourceOptionsRef);
// release core foundation object
CFRelease(imageSource);
}
else
{
// Error opening image file
HLSLoggerFatal(@"Image source could not be accessed at path %@", [self pathLastRawDataSave]);
}
}