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.
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?
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.
Disclaimer: I know the question of locking orientation has been asked, and solved. But that's only half my question.
I'm building an iphone website for a small indie game developer. They want to be able to show off screenshots from some of their iphone games. This is somewhat of a problem though. All the screenshots are taken from the game in landscape mode, so it really doesn't make any sense to display them in landscape.
Currently I have a very lightweight lightbox-style display for the image. You click a button on the site, and the image pops up (through ajax magic!) to occupy the full screen. Clicking anywhere on the image makes it go away, as if you had never viewed it.
I'm thinking that the two most practical solutions are either: a) lock iphone orientation for the duration of displaying the image; or b) do some very sneaky rotation on the image when the phone rotates, so no one ever notices. Are either of these possible/feasible? If so, could you give me any tips? And if not, has anyone solved a similar problem?
A demo of this is available at my personal server.
My $.02
As a personal design decision - I would have two images, and switch them as the rotation changes from portrait to landscape. Locking orientation seems so unfriendly. As some extra eye candy, You may want to put some sort of transition image in there between image swaps.
Here is something that may help .. http://snippets.dzone.com/posts/show/4912
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.