Simple Transforms with Core Image
Using transforms with CIImage objects is easier than I thought. Up until recently, I would create a NSAffineTransform and wrap it in an affine transform filter object, pipe the image in and get the result. Here's what that looks like:CIImage* inputImage; // assume this exists
float factor = 0.5;
CIFilter *filter = [CIFilter filterWithName:@"CIAffineTransform"];
[filter setValue:inputImage forKey:@"inputImage"];
NSAffineTransform *trans = [NSAffineTransform transform];
[trans scaleXBy:factor yBy:factor];
[filter setValue:trans forKey:@"inputTransform"];
CIImage * outputImage = [filter valueForKey:@"outputImage"];
This is all very straightforward, but there's an even easier way:
CIImage* inputImage; // assume this exists
float factor = 0.5;
CGAffineTransform trans = CGAffineTransformMakeScale(factor,factor);
CIImage* outputImage = [inputImage imageByApplyingTransform:trans];
How great is that? You can use this with any of the CGAffineTransform functions, some of which are listed here:
CGAffineTransformMake()
CGAffineTransformMakeTranslation()
CGAffineTransformMakeScale()
CGAffineTransformMakeRotation()
The complete list is in CoreGraphics/Headers/CFAffineTransform.h. CoreGraphics itself is in the ApplicationServices framework.
Of course, you're still better off using the CIFilter approach if the transform is one of a stack of changes you're making to an image. In that case, all of the changes will be combined and the final rendering is finished much more quickly.

Simple Transforms with Core Image
Posted Mar 14, 2007 — 8 comments below
Posted Mar 14, 2007 — 8 comments below
Steven Canfield — Mar 14, 07 3724
I'm like the editor of your nightmares.
Vickie — Mar 14, 07 3725
After you have added all of the desired transformations to the transform object, you call the concat method to apply them to the current context. Calling concat adds your transformations to the CTM of the current graphics context. The modifications stay in effect until you explicitly undo them, as described in “Undoing a Transformation”, or a previous graphics state is restored.
Documentation link
Dave Arter — Mar 14, 07 3726
TC — Mar 14, 07 3727
Andy Lee — Mar 14, 07 3728
Philip Orr — Mar 14, 07 3729
The typos in your examples as pointed out above seem to be exercises. Why do you think these won't work?
Philip.
Scott Stevenson — Mar 14, 07 3734
David Gelphman — Apr 26, 07 3972