Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
15 lines (13 sloc) 408 Bytes
// From Apple documentation
CGImageRef CreateCGImageFromFile(NSString* path)
{
NSURL* url = [NSURL fileURLWithPath:path];
CGImageRef imageRef = NULL;
CGImageSourceRef sourceRef;
sourceRef = CGImageSourceCreateWithURL((CFURLRef)url, NULL);
if(sourceRef) {
imageRef = CGImageSourceCreateImageAtIndex(sourceRef, 0, NULL);
CFRelease(sourceRef);
}
return imageRef;
}