My application supports taking pictures from iPhone in portrait mode and upload to the server.
However, the pictures taken are appearing in sideways once uploaded to the server.
Please help!
-KC
Keep in mind that the image has an associated imageOrientation property that will determine the correct orientation to display the image.
Images captured used AV Foundation (at least using AVCapture, which I'm using) are taken in landscape mode, so you have to rotate them clockwise before sending to the server.
Related
I'm building an application which takes photos using the UIImagePickerController. Works great.
The problem however is that I don't want to use image rotation. I always want a photo in portrait mode just as the user sees it on the screen.
When you take your iPhone on the side and then slowly take it back to normal the orientationmode isn't updated. Now when you take the photo the orientation flags in the EXIF data are set.
Is there a way to get rid of orientation support in de imagepicker? Could I just disable the accelerometer?
Making an app where we want to send a photo to a server along with some form data. For some reason any photo taken in portrait-mode gets sent rotated 90 degrees once on the server. Pretty sure we're missing something obvious here, but we're struggling to find any solution to this.
UIImage has an imageOrientation property. If you are using UIImage's then you need to take that into account when sending the image to the server, either by sending the orientation info to the server or else rotating the image (if the orientation isn't what the server expects).
Yes, portrait photos are only displayed as portrait because the phone is turned 90 degrees. All photos will come through as landscape because even though the software in the phone realizes the phone has been turned, the photo sensor doesn't. You will have to include a checkbox or something in the form to say "portrait" and pass that along in the form data and than use imaging software on the server to rotate the image to landscape if the box is checked.
My goal is to write a custom camera view controller that:
Can take photos in all four interface orientations with both the back and, when available, front camera.
Properly rotates and scales the preview "video" as well as the full resolution photo.
Allows a (simple) effect to be applied to BOTH the preview "video" and full resolution photo.
My previous effort is documented in this question. My latest attempt was to modify Apple's sample GLVideoFrame (from WWDC 2010). However, I have not been able to get the iPhone 4 to display the preview "video" properly when the session preset is AVCaptureSessionPresetPhoto.
Has anyone tried this or know why the example doesn't work with this preset?
Apple's example uses a preset with 640x480 video dimensions and a default texture size of 1280x720. The iPhone 4 back camera delivers only 852x640 when the preset is AVCaptureSessionPresetPhoto.
iOS device camera video/photo dimensions when preset is AVCaptureSessionPresetPhoto:
iPhone 4 back: video is 852x640 & photos are 2592x1936
iPhone 4 front: video & photos are 640x480
iPod Touch 4G back: video & photos are 960x720
iPod Touch 4G front: video & photos are 640x480
iPhone 3GS: video is 512x384 & photos are 2048x1536
Update
I got the same garbled video result when switching Brad Larson's ColorTracking example (blog post) to use the AVCaptureSessionPresetPhoto.
The issue is that AVCaptureSessionPresetPhoto is now context-aware and runs in different resolutions based on whether you are displaying video or still image captures.
The live preview is different for this mode because it pads the rows with extra bytes. I'm guessing this is some sort of hardware optimization.
In any case, you can see how I solved the problem here:
iOS CVImageBuffer distorted from AVCaptureSessionDataOutput with AVCaptureSessionPresetPhoto
The AVCaptureSessionPresetPhoto is for taking pictures, not capturing live feed. You can read about it here: http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/03_MediaCapture.html
(My belief is that this is actually two different cams or sensors, as they behave very differently, and there's a couple of seconds delay just for switching between the Photo and, say, 640x480).
You can't even use both presets at the same time, and switching between them is a headache as well - How to get both the video output and full photo resolution image in AVFoundation Framework
HTH, although not what you wanted to hear...
Oded.
I recently uploaded some screenshots of my app to itunesconnect. All the screenshots are in landscape mode (I rotated them using iPhoto). On the itunesconnect page where I uploaded the screenshots they all appeared in landscape mode... fine. Now on another page in itunesconnect they all appeared in portrait mode (and they were squished). How will the images appear in the app store? Landscape just like I uploaded them? or perhaps I need to set something somewhere to let the app store know.
I just want to prevent my app from going live w/ squished screenshots.
Cheers!
You should be able to take your screenshots, rotate them 90 degrees, and upload them. Make sure the images are 480 wide by 320 tall, and you should be ok.
See this article for more info:
http://www.appsizematters.com/2010/06/appstore-screenshots-101/
or:
http://thesalon.blogspot.com/2010/02/how-to-submit-app-to-iphone-app-store.html
In particular, from the latter link,
Portrait Mode 320x460 Minimum; 320x480 Maximum - 72ppi, RGB, flattened, no trans, High quality jpg or TIFF image file format. Do not include the iPhone status bar.
Landscape Mode 480x300 Minimum; 480x320 Maximum - 72ppi, RGB, flattened, no trans, High quality jpg or TIFF image file format. Do not include the iPhone status bar.
This can be quite a confusing issue because iTunesConnect will show a landscape-oriented iPhone screenshot in landscape orientation, but when you view it from the iPhone app store application, the screenshots will be forced to portrait orientation.
A look at the iTunesConnect Developer Guide, page 13 provides some insight on Apple's reasoning:
To view a landscape mode screenshot on the device App Store, users will have to rotate their iPhone to view landscape.
So when viewing screenshots on the actual device, iPhones and iPod Touches switch any landscape-mode screenshots to portrait mode and the user must rotate their phone to landscape mode to see the screenshot correctly.
The good news is you can update your screenshots at any time. So do a little trial and error and you'll get it looking good.
I'm currently developing an app that has a camera functionality, with a custom camera screen, featuring a preview screen and an overlay.
I'm using the AVFoundation classes and methods as per the eradication of UIScreenCapture.
The problem I have is that the preview data I get from AVCaptureSession is too zoomed in. If i take a picture with that screen, and another with the iPhone's default camera app, without moving the iPhone, the difference in zoom is far too much.
I need the zoom of my app to be the same as is default for iPhone camera app.
I've tried changing the AVCaptureVideoPreviewLayer.videoGravity, to any of it's 3 possible values, to no avail.
Please, any leads on this problem are truly appreciated.
Arcantos' solution was mostly correct. That will work assuming you're on an iPhone 3G (or any device with a camera that supports 640x480). An iPhone 4 may run into some issues there.
A more correct way would be to test for the availability of and apply this preset:
captureSession.sessionPreset = AVCaptureSessionPresetPhoto;
This will use the raw camera data, regardless of the native resolution.
Turned out to be a resolution issue.
It was fixed by using
myCaptureSession.sessionPreset = AVCaptureSessionPreset640x480
Note that iPhone 3g does not support that, so you have to ask wheter the device supports it
[[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo] supportsAvCaptureSessionPreset:AVCaptureSessionPreset640x480]
Is the aspect ratio of your preview pane identical to that of the camera capture data? If not, the OS may be changing the zoom to fit the data rect into your requested aspect ratio.