Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sheetal.pawar

macrumors newbie
Original poster
Aug 12, 2010
8
0
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
 
Last edited by a moderator:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.