I'm trying to combine some greyscale images with different alphas to create a layered affect. I'm loading images into a UIImageView and on screen it looks as expected. However, when I save the combined image, only the top layer gets saved; Is it possible to create and save a combined image layer?
I'm enclosing links to the images - one is a screenshot of what the images should look like (layered) and the other is the simple single-value one that ends up saving (non-layered).
https://dl.dropboxusercontent.com/u/8263889/good.png - this is what I want https://dl.dropboxusercontent.com/u/8263889/bad.png - this is what happens.
thoughts?
Are you trying to save to a UIImage? If so, try this.
+ (UIImage *)imageWithView:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}