1

I am using UIImagePickerController for taking photo. For full size photo I am using this method

var cameraAspectRatio : CGFloat = 4.0 / 3.0;
var imageWidth = floorf(Float(screenSize.width * cameraAspectRatio));
var data = Float(screenSize.height)/imageWidth
var scale = CGFloat(ceilf((data * 10.0) / 10.0))

cameraViewTransform = CGAffineTransformMakeScale(scale, scale)

but after capturing image, the view that I saw in camera layer is different with photo(photo takes more view in, so it is bigger)

I want to make a photo, and output photo the same scale and view, using the whole fullscreen overlay. Can you advice some?

sagar.musale
  • 585
  • 1
  • 7
  • 19

2 Answers2

0

I took help from this link in one of my project: UIImagePickerController doesn't fill screen

Hope this helps.

Community
  • 1
  • 1
Dharmesh Siddhpura
  • 1,610
  • 12
  • 22
  • 1
    I saw this answer, and used it to fill full screen, but there is another problem - view that I take photo is scaled, and image that I get isn't, so they are different – Spencer_Reid Sep 21 '15 at 10:04
0

The trick is to have the view delivering the video-preview not overscanning the screen, and being in the right aspect-ratio.

My guess would be that there is two place you have to have a look at:

  1. AVCaptureVideoPreviewLayer's previewLayer-property.
  2. Your AVCaptureSession's sessionPreset

If the latter is of the type AVCaptureSessionPresetPhoto your frame calculations seems OK (as this is in the-format 4:3), but double-check this bit.

The previewLayer should then be AVLayerVideoGravityResize as this fills the preview to fit inside the view you have resized properly.

T. Benjamin Larsen
  • 6,373
  • 4
  • 22
  • 32