Probleme with the Nexus S , after a first probleme Cwac-camera crash when picture taken:
I take a photo with a screenOrientation:portrait, but a catch a Landscape picture, so with a rotation of 90°
In the code
In my SimpleCameraHost extended class, the bitmap received have the dimension of a landscape image
@Override
public void saveImage(byte[] image)
{
Bitmap bitmap = BitmapFactory.decodeByteArray(image, 0, image.length);
...
LOG bitmap.getWidth => 2560
LOG bitmap.getHeight => 1920
The orientation of the photo should match the actual orientation of the device. IOW, if the device is held in portrait, the image should be portrait. If the device is held in landscape, the image should be landscape. The choice of android:screenOrientation
value (or not having it at all) should not affect those results -- it will merely affect the way that your UI behaves.
I just tested this on a Nexus S, and the rear-facing camera is working as expected. I added android:screenOrientation="portrait"
to the demo app, and when the device is held in portrait mode, the photos are saved in portrait, and when the device is held in landscape mode, the photos are saved in landscape.
If you believe that you have evidence to the contrary, create a sample project that reproduces the error, and file an issue on the project, posting that sample project and the steps in running it to reproduce the error.
UPDATE
OK, I think I understand now what you're seeing. Bitmap.decodeByteArray()
apparently pays attention to EXIF headers, whereas a lot of image viewers do not. The Nexus S behaves differently from the other Samsung devices that I have tested so far, and I need to do a little cleanup work on those headers for Nexus S output. I have added an issue about this, and I will hopefully be able to work on this soon.
BTW, I also have logged an enhancement request to give you a Bitmap
via another saveImage()
method, to avoid your having to decode the byte[]
.