开发者

Help on saving the images

I have the follwoing code to save the image but it seems poor in quality...

is there any way to get the images in a fine quality?

Thanks for any help

UIGraphicsBeginImageContext(CGSizeMake(self.view.bounds.size.width,
                                                   self.view.bounds.size.height-50)); 
CGContextRef context = UIGraphicsGetCurrentContext();
CGCo开发者_如何学JAVAntextTranslateCTM(context, 0, -50);    
[self.view.layer renderInContext:context];
UIImage* viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(  );
NSData* imageData = [NSData dataWithData:UIImageJPEGRepresentation( viewImage,0 )];


First thing that comes to mind is a compression quality parameter in UIImageJPEGRepresentation function - you set it to the lowest quality (0.0), try to set it to maximum quality value:

NSData* imageData = [NSData dataWithData:UIImageJPEGRepresentation( viewImage,1.0 )];


One option as it is mentioned in Vladimir's answer. Another option is you can use the UIImagePNGRepresentation. It will use the PNG format.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜