iOS: Creating a Custom Camera with AVFoundation
For a functionality in a current project, we needed a custom camera that took square pictures. After a decent amount of googling, it doesn’t seem like there is a pre-built functionality in AVFoundation that takes and output square photos. By default, all the preset Capture Session only allows the camera in the dimension of the screen.
Here was my idea as a workaround.
- Create two overlay frame of UIImageView, one top, one bottom.
- Size the two frame so it covers the Capture Session into a square, or whatever shape you are trying to get.
- Add a button to take the picture!
- Size the captured image to crop the designated area and shape.