2

After capturing a fullscreen image, I need to crop the original image based on an crop overlay which essentially is just a CGRect.

This is how it looks like

enter image description here

I understand that crop filter's region values should be between 0 to 1. This is the piece of code that is supposed to do the cropping

- (UIImage *)crop:(UIImage *)source
{
    CGRect cropRect = CGRectMake(26, 75, 710, 710);
    // This is where the magic should happen to convert the rect to an OpenGL units
    CGRect cropRegion = CGRectMake(x, y, width, height);
    cropFilter = [[GPUImageCropFilter alloc] initWithCropRegion:cropRegion];

    return [cropFilter imageByFilteringImage:source];
}
Peymankh
  • 1,976
  • 25
  • 30
  • 1
    Has that got anything to do with normalising a CGRect? http://stackoverflow.com/questions/16041538/normalising-cgrect-between-0-and-1 – Peymankh Aug 22 '13 at 11:35

0 Answers0