开发者

UIImage from UIView has too big size

开发者 https://www.devze.com 2023-02-18 06:40 出处:网络
I have small section of code below: - (UIImage *)imageFromView:(UIView *)myView{ if (UIGraphicsBeginImageContextWithOptions!=NULL)

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?

0

精彩评论

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