iOS : Save image with custom resolution

前端 未结 9 2023
长发绾君心
长发绾君心 2020-12-08 03:42

Hi I am try to capture a view then save as an image into Photo Library , but I need create a custom resolution for captured image , here is my code but when app saves the im

9条回答
  •  [愿得一人]
    2020-12-08 04:01

    -(UIImage*)processImageRect:(UIImage*)image:(CGSize)sizeToForm {
        // Draw image1  
        UIGraphicsBeginImageContext(CGSizeMake(sizeToForm.width, sizeToForm.height));  
        [image drawInRect:CGRectMake(0.0, 0.0, sizeToForm.width, sizeToForm.height)]; 
        UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
    
        return resultingImage;
    }
    

    Go with this may solve your issue.

提交回复
热议问题