CFHipsterRef Low-Level Programming on iOS & Mac OS X

Reading from a File

NSURL *fileURL = [NSURL fileURLWithPath:@"/path/to/input.jpg"];
NSDictionary *options = @{
    (__bridge id)kCGImageSourceTypeIdentifierHint: @"{public.jpeg",
    (__bridge id)kCGImageSourceShouldCache: @(YES),
    (__bridge id)kCGImageSourceShouldAllowFloat: @(YES),
    };

CGImageSourceRef imageSourceRef =
    CGImageSourceCreateWithURL((__bridge CFURLRef)fileURL, NULL);
CGImageRef imageRef =
    CGImageSourceCreateImageAtIndex(imageSourceRef, 0, (__bridge CFDictionaryRef)options);

UIImage *image = [UIImage imageWithCGImage:imageRef];

CFRelease(imageRef);
CFRelease(imageSourceRef);