Can't apply GPUImageSwirlFilter filter after using UIGraphicsGetImageFromCurrentImageContext
Wed, 05/23/2012 - 03:01
Hi Brad Larson,
I'm using UIGraphicsGetImageFromCurrentImageContext to crop a uiimage,
after cropping the image and apply the GPUImageSwirlFilter,
the filter effect isn't correct....... the image width and height bigger then before
here is the code for cropping uiimage
-(UIImage *)cropImage:(UIImage *)img withRect:(CGRect)rect { UIGraphicsBeginImageContextWithOptions(rect.size, NO, [[UIScreen mainScreen] scale]); [img drawRect:CGRectMake(0, 0, img.size.width, img.size.height)]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; }
Please help me, many thanks!
Wed, 05/23/2012 - 22:04
#2
the filter part, my origin image size is 640x480, then I use the script to crop it to 100x100.
after I crop the image and apply the GPUImageSwirlFilter, the return image doesn't correct and also the size is getter bigger than 100x100.
the GPUImageSwirlFilter work fine on any origin image.
here is the filter script
GPUImageSwirlFilter *filter = [[GPUImageSwirlFilter alloc] init]; UIImage *output = [filter imageByFilteringImage:UIImage];
What part of this is wrong? The UIImage cropping or the filter? If the filter, what's the input size, output size, and code you use to run the filter?