Skip to content

Commit 3322f24

Browse files
committed
Faster cropping
1 parent e22e0b8 commit 3322f24

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

FastttCamera/UIImage+FastttCamera.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,10 @@ - (UIImage *)fastttImageWithNormalizedOrientation
190190
FastttRound(self.size.width),
191191
FastttRound(self.size.height));
192192

193-
UIGraphicsBeginImageContextWithOptions(newRect.size, YES, self.scale);
194-
[self drawInRect:newRect];
193+
CGImageRef imageRef = CGImageRetain(CGImageCreateWithImageInRect([self CGImage], newRect));
195194

196-
UIImage *normalized = UIGraphicsGetImageFromCurrentImageContext();
197-
UIGraphicsEndImageContext();
195+
UIImage *normalized = [UIImage imageWithCGImage:imageRef];
196+
CGImageRelease(imageRef);
198197

199198
return normalized;
200199
}

0 commit comments

Comments
 (0)