CoreGraphics Image resize
core-graphics, ios, ios5, iphone
Solution
School boy mistake.
Didn't add `#import <ImageIO/ImageIO.h>`
Problem
This code is from Apple's WWDC 2011 Session 318 - iOS Performance in Depth and uses CoreGraphics to create thumbnails from server hosted images. ``` CGImageSourceRef src = CGImageSourceCreateWithURL(url); NSDictionary *options = (CFDictionaryRef)[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:1024 forKey:(id)kCGImageSourceThumbnailMaxPixelSize]; CGImageRef thumbnail = CGImageSourceCreateThumbnailAtIndex(src,0,options); UIImage *image = [UIImage imageWithCGImage:thumbnail]; CGImageRelease(thumbnail); CGImageSourceRelease(src); ``` But it doesnt work and the docs don't really help. In the iOS docs `CGImageSource` `CGImageSourceRef` `CGImageSourceCreateThumbnailAtIndex` are available in Mac OS X v10.4 or later How can I get this to work? EDIT These are the compiler errors I'm getting: - Use of undeclared identifier 'CGImageSourceRef' - Use of undeclared identifier 'kCGImageSourceThumbnailMaxPixelSize' - Use of undeclared identifier 'src' - Implicit declaration of function 'CGImageSourceCreateThumbnailAtIndex' is invalid in C99 - Implicit declaration of function 'CGImageSourceRelease' is invalid in C99 - Implicit declaration of function 'CGImageSourceCreateWithURL' is invalid in C99