Skip to content

Commit ba54647

Browse files
committed
Faster cropping
1 parent e22e0b8 commit ba54647

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

FastttCamera/UIImage+FastttCamera.m

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

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

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

199199
return normalized;
200200
}

0 commit comments

Comments
 (0)