This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(UIImage*) cropCameraImage:(UIImage*) original toPreviewLayerBounds:(AVCaptureVideoPreviewLayer*) previewLayer { | |
UIImage *ret = nil; | |
CGRect previewImageLayerBounds = previewLayer.bounds; | |
// This calculates the crop area. | |
// keeping in mind that this works with on an unrotated image (so a portrait image is actually rotated counterclockwise) | |
// thats why we use originalHeight to calculate the width | |
float originalWidth = original.size.width; | |
float originalHeight = original.size.height; |