Question

I have made a program for image effects but when I try to add the effects like photoshop using the code below the image is not allocated any memory and therefore the resulting image is not shown.

UIImage *bottomImage = originalImage;
UIImage *upperImage = originalImage;

UIGraphicsBeginImageContextWithOptions(sizeR, YES, imageBeforeEffect.scale);
[bottomImage drawInRect:CGRectMake(0.0, 0.0, sizeR.width, sizeR.height)];
 [upperImage drawInRect:CGRectMake(0.0, 0.0, sizeR.width, sizeR.height) blendMode:kCGBlendModeDarken alpha:1.0];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Was it helpful?

Solution

Check if your sizeR has got any frame... put a break - point and check it. If there is no frame then the UIGraphicsBeginImageContextWithOptions will not work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top