If you create a filtered image using imageWithCIImage, then you will not get the proper aspect ratio. Try creating a CGImageRef from the output file of the CIImage filter, and then create a UIImage from CGImageRef.
Example:
// assume you already have CIImage *outputImage and *inputImage declared // convert to CGImage to maintain proper aspect ratio and dimensions CIContext *context = [CIContext contextWithOptions:nil]; CGImageRef imageRef = [context createCGImage:outputImage fromRect:inputImage.extent]; UIImage *filteredImage = [UIImage imageWithCGImage:imageRef]; CGImageRelease(imageRef);
Then you can try to set the image using filterImage.
source share