Crash when process pixel after crop an image

后端 未结 1 328
陌清茗
陌清茗 2021-01-16 13:14

After using this function to crop image:

CGImageRef imageRef = CGImageCreateWithImageInRect([self.imageInput CGImage], rect);
UIImage *result = [UIImage imag         


        
相关标签:
1条回答
  • 2021-01-16 14:13

    after a long time find solution for this crash. I got an experience: - When process bitmap on iOS: if we don't notice orientation of image, maybe we got some strange crash.

    With my crash above: I have fixed it very simple: change

    UIImage *result = [UIImage imageWithCGImage:imageRef];
    

    by

    UIImage *result = [UIImage imageWithCGImage:imageRef scale:self.imageInput.scale orientation:self.imageInput.imageOrientation];
    
    0 讨论(0)
提交回复
热议问题