UIImageWriteToSavedPhotosAlbum saves to wrong size and quality

前端 未结 2 1382
别跟我提以往
别跟我提以往 2020-11-29 07:54

I\'m trying to take a screen shot of my app\'s current view and save it to photo album (to then be emailed or MMS\'ed).

UIGraphicsBeginImageContext(self.vie         


        
相关标签:
2条回答
  • 2020-11-29 08:13

    I found a decent workaround, which is to essentially rewrap the UIImage as a PNG, then save the rewrapped version. Code looks something like this:

    UIImage* im = [UIImage imageWithCGImage:myCGRef]; // make image from CGRef
    NSData* imdata =  UIImagePNGRepresentation ( im ); // get PNG representation
    UIImage* im2 = [UIImage imageWithData:imdata]; // wrap UIImage around PNG representation
    UIImageWriteToSavedPhotosAlbum(im2, nil, nil, nil); // save to photo album
    
    0 讨论(0)
  • 2020-11-29 08:15

    I had that same error, on my part, that was solved when I rounded the decimal points to be the same scale as the iPhone, try it, make sure the scale is 1.0, 2.0, etc and not 3.1, that will throw it off.

    0 讨论(0)
提交回复
热议问题