Save zoomed image from camera

Discussion in 'iOS Programming' started by sheetal.pawar, Jun 9, 2011.

  1. sheetal.pawar, Jun 9, 2011
    Last edited by a moderator: Jun 10, 2011

    sheetal.pawar macrumors newbie

    Joined:
    Aug 12, 2010
    #1
    Hi,

    I am developing a camera application for iphone/ipad.
    We are using an overlay for displaying the camera app on top of the viewfinder.
    Currently i am trying to save the zoomed image. We are able to zoom the image on viewfinder. But when we save the image it gets saved in the original size.
    To solve this we are scaling the zoomed image using the following code :

    Code:
    UIImageView *v = [[UIImageView alloc]initWithImage:image];
    
    UIGraphicsBeginImageContext(v.bounds.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
            
    CGContextSaveGState(context);
    CGContextScaleCTM(context, zoomvalue,zoomvalue);
     [v drawRect:CGRectMake(0,0,320,480)];
    CGContextRestoreGState(context);
    image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    //////////////////////////////////////////////

    Using the above code we are able to get the zoomed image.
    However, we need to crop the center portion of the scaled image and save the same. We are not getting the same.

    Kindly help
     
  2. dantastic macrumors 6502

    dantastic

    Joined:
    Jan 21, 2011
    #2

Share This Page