I've been searching for a while, but haven't found a solution.
I'm trying to get my app to capture a photo but always force the photo to be a portrait photo, regardless if you take the photo with your phone in portrait or landscape (Pretty much how Snapchat handles photos being taken).
I've made the app only portrait and that works fine, but if I take a photo with my phone in landscape, the android camera then flips the photo 90 degrees to be landscape.
As it's a portrait only app, I want to be able to show the full image in portrait (the user can turn their phone if the image is sideways!)
Any thoughts on this? I've tried setting targetWidth, targetHeight & correctOrientation but cannot seem to get it to work at all.
Here's what currently happens:
http://postimg.org/image/9k51ptfb1/
And here's what I want to happen:
http://postimg.org/image/mkxvu7nlj/
Note - the suggested duplication has an answer of "can't be done" with no other details, which is obviously not an answer!
Thanks,
Gary
Related
I'm trying to take image from camera and then post it to my server for Android.The problem is when I take image it gets rotated to 90 degree. I tried different solutions but I didn't meet success.I tried to capture the orientation of screen in which camera was open so that I can rotate ImageView, but it didn't work.
If anyone faced this problem and knows the solution, please help. I would be grateful.
Android SD : 5.2.0, Testing Device : Samsung A700FD, OS : 5.0.2.
This is a known bug, but there is a workaround with this module:
https://github.com/ricardoalcocer/AndroidRotateImage
"There's a annoying, yet somewhat rare issue when taking photos with certain Andorid devices, where the orientation information is not properlly identified by Titanium, causing a photo taken in portrait format to be returned as landscape.
[...]
Besides rotating the image, the library scales the image to the specified width, and compresses it to the specified percentage. This is particulary useful, since Android camera images can be huge and could potentially make your device run out-of-memory."
I am using Metaio SDK 5.3 (for Android) for Instant Tracking.
My aim - I want to capture an image on device A and want use the same image for tracking on device B.
My approach - I have extended InstantTracking tutorial to capture an image and save it to send it across to device B using this method,
metaiosdk.requestCameraImage(path);
And am saving the tracking XML file simultaneously, to send across to device B.
Problem - When I capture an image in PORTRAIT mode, somehow, metaio saves it in landscape mode and so the resulting augmentation is 90 degrees rotated. When I capture an image in landscape mode, the augmentation is perfect.
Instant tracking initiated by "Instant 2D" button when device was in landscape mode. Augmentation content was augmented in landscape mode, alt text
Instant tracking initiated by "Instant 2D" button when device was in portrait mode. But this time, augmentation content was augmented in landscape mode, alt text
Is there a way I can control how the captured image is saved? Or why is metaio saving the portrait image in landscape mode?
Am I missing something here? Any help is much appreciated.
Thanks in advance!
Please see the answer on Metaio Helpdesk:
http://helpdesk.metaio.com/questions/33971/portrait-mode-image-saved-as-landscape-mode-by-requestcameraimage
I have recently started studying Android, and I would, as first application, create my own camera. After taking a look at the API and other examples on the internet, I was able to create a working app, however I have this problem: if I rotate the tablet that I'm using to try what I do, my app rotates in the wrong way.
So, when I switch from portrait to landscape, the transition is successful and buttons rotate correctly, but what camera really sees is as if it were rotated 90 degrees more than it should.
All this unless I decide to set in my activity screenOrientation: landscape, because in this case the camera sees everything correctly, but the buttons remain fixed in one place, don't rotate with the rotation of the tablet.
I have a tablet with only front-facing camera.
What can I do to fix the problem?
check this answer I gave some time ago, it does have a nice method to call to correctly set the camera orientation.
How can I know the position of the camera on an android device?
and with that code you should let your activity rotate freely
I have a server component that processes video uploads for a web/iOS/Android application.
However I am running into a problem handling the video orientation. Is there a good way to solve this? I have a tool MediaInfo that rips the meta data out of the device but this is what i am encountering
iOS
the portrait is correct 90 or 270
the landscape is crazy. if you hold the device with the button to the left, it reports 0 for the front camera and 180 for the back
Android
here the situation is reversed the landscape is correct both front and back camera
the portrait is 90 or 270 depending on if you are using the front or back camera
furthermore some devices like Motorola Droids and Evo4G dont record the meta data at all
has anyone seen a clean solution for this?
There is no clean solution for android devices that do not report the orientation.
For all the other orientations, I had overly complicated it in my mind. The flip between front and back means the angles are correct if rotated clockwise
I notice that when you take photos with the native camera app, they come out portrait or landscape (as they should), however, when I take photos in my app using the Camera class, they are always landscape, no matter how I'm holding the device.
I'm really hoping I don't have to monitor the orientation of the device and manually rotate the images... is there a less silly way to get this done?
TIA
You dont need to use accelerometer. You can just check the orientation by the time the photo is taken.
Developer Android
getResources().getConfiguration().orientation