My application allows users to composite images (add and then rotate, scale, move) on top of a background image and save the final edit to the camera roll.
The main editing ViewController's view is the top of a UIView hierarchy. To this view I add as a subview a UIImageView with an image from the Camera Roll or from the Camera. The user than adds additional characters (dogs, cats, etc.), each implemented as a seperate UIView which can be rotated, moved and scaled.
When the user is done editing, i want to save the entire scene to the camera roll at the highest resolution available - the resolution of the background image 1936X2592 pixels (the UIImageView) on iphone4.
At the moment i use the code below, however this only gives me the display resolution of the scene and not the full resolution of the image in memory. any suggestions? (i tried increasing the context size, in the code below, to the full background size, but no luck there)
// create a CG context
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, [UIScreen mainScreen].scale);
// render into the new context
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
// get the image out of the context
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();