UIImage from UIView has too big size
I have small section of code below:
- (UIImage *)imageFromView:(UIView *)myView{
if (UIGraphicsBeginImageContextWithOptions!=NULL)
{
UIGraphicsBeginImageContextWithOptions(myView.bounds.size,NO,0.0);
}
else
{
UIGraphicsBeginImageContext(myView.bounds.size);
}
[myView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return [[viewImage retain] autorelease];
}
After getting UIImage from this function. I save it into photo library. But the size of image is too big. It's pretty different from original image. Anyone has s开发者_如何学Pythonolution for this. Please help me. Thank you all so much.
NSLog()
the current myView.Bounds.size
and also check which statement gets called.
How big is your image and how big should it be?
精彩评论