How do you capture full screen camera photos on iOS? - ios

On Snapchat, it allows you to take a full screen camera photo on iOS. The preview is full screen, and the image returned is full screen. There appears to be no cropping/stretching/etc... What you see is what you get.
Now I've looked all over the place, and I can't figure out how this is actually being done, seeing that the iPhone camera always returns an image with an aspect ratio of 4:3. Yes, you can use the camera view transform to have a full screen "preview", but the image returned is still 4:3 and needs to be cropped.
So my question is, how do you take a full screen camera photo on iOS without cropping? If your answer is that it can't be done, then how is Snapchat doing it (or appearing to do it)?

Snapchat isn't displaying everything the camera is picking up. By cropping a bit from the top/bottom or sides, they can create a 16:9 image from a 4:3 image. This is easy to verify.
Open up the snapchat and camera apps so it's easy to switch between them.
Place your phone on its side pointed at something with some marks for reference points.
Switch between the apps without moving the phone. There is content that you do not see on Snapchat.

Related

AVFoundation format for different aspect ratio

I am using AVFoundation for my camera app. I am using live video frames to grab picture using AVCaptureVideoDataOutput.
Right now i do filter all supported formats for device and then pick highest supported resolution for format.
So for example i do get 4032*3024 resolution supported format on iPhone 8/7 which i am using as active format. i do filter from videoSupportedFramRateRanges.
I would like to know how i can render video with 4:3 resolution so i can see black bars on side of camera.
I did play with AVCaptureVideoPreviewlayer properties and found that if i use resizeAspectFill it shows camera full screen but if i just dont assign then it adds black bars on side. (I assume .resize is default property) but i am not sure whether this is right approach to show/hide black bars.
In my opinion this is working because currently i am picking highest supported resolution format which in this case is 4032*3024 due to which its working since its 4:3 aspect ratio.
Basically i want make sure i show video in 4:3 format size view in some scenario with black bars and in some scenario full screen which i am already doing.
Open questions
Is there any way i can make sure i can show always 4:3 aspect ratio video feed.
How i can show black bars with 4:3
also after showing black bar how I can get camera area without black bars?
Thanks!

Know if picture is Selfie or Portrait

I'm coding an app where users can upload pictures and add some filters to it.
The problem is that when I apply filter on it, the picture is rotating, ONLY if the picture has been taken with back camera.
If it was a selfie the picture is not rotating
If the picture is in portrait mode, the picture is not rotating
The problem is that I don't know how I could get these information, in order to rotate the picture only when I need it.
You're thinking about this the wrong way. It may be the case that images taken with your phone's rear camera appear rotated after applying a filter, but you cannot make this assumption for all devices. Instead, you can read the imageOrientation property on UIImage to obtain information about whether the image has an unusual rotation.

Export portrait video to square but with scaleAspectFit ratio

In my app I allow users to record videos in portrait mode. I use that within the app and that is fine. However, I'm implementing a feature to share the videos on Instagram, where videos must be square.
Cropping the video to square, lets say the center part, is an option, however as the user doesn't consider this when taking the video, it usually turns out bad.
Therefore, I'd like to export the video square, but with an aspect fit ratio and with two bars left and right. Optimally, is there any way to define the colors of the background (either by code or by UIImage).
The closest thing I was able to find is this, however I can't make much use of it as I'm unclear on how to set up the transformation.
Example (red box just to mark the image bounds):
Beside trying to add black bars and re-render the video you can use the cameraOverlayView property of UIImagePickerController.
So you can create a view that has 2 black bars in OR you can create a view that has a square frame over the camera view so they know to frame it in there because it will share to instagram.

How to set zoom level of camera using AVFoundation framework in IOS?

I am developing a custom camera in which the camera is set to the Image Capture mode. I need to increase the zoom level of camera preview according to the app requirements. The preview currently being displayed is perfect I just need to increase the zoom-out in current preview. I searched over internet but didn't find any solution. Please tell me how can I do this. I am attaching the example image for better understanding. first image is of my camera app and second image is of Scanner Pro app which shows view with more covered area while I focus both the apps for the same object on the same distance. My camera don't have any space but the Scanner camera has spacing all over the image. Both the camera are on the same distance from the paper.
i don't know whether you still need this answer. Probably not, but still for you and everyone else looking out:
When you set the Session Preset, try using SessionPresetPhotofor the device object. This should resolve the weird zoom issue.
Your preview view is probably spilling over the edge of the screen. Make sure it is a 4:3 aspect ratio and that it doesn’t overflow your screen edges. With that you should see more of your image.

Camera/photo gallery in corona sdk

In my application,I used PhotoLibrary,it get photo, small part of that image.In full image it picks only the corner part.i searched over the net it tells,it checks the device size and image size return device size image only.then how it is possible to bring whole image.
Many photos are larger than the screen size. Corona can only show what's on screen. You have two choices, put the larger image inside of a widget.newScrollVew() so you scroll around and see the larger image, or scale the image down until it fits on the screen.

Resources