Android Question CameraExClass weird problem

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
Hi, I dont know if I will explain it very well
Compiling the example of CameraExClass, when I see the phone screen, the aspect ratio of the image is no ok, in portrait mode the image is taller than the reality and in landscape its wider but, when I save the picture is ok.

Im using the code suggested in :https://www.b4x.com/android/forum/threads/cameraex-stretching-preview.62462/

This code changes the Panel1 layout ok, but what you see inside panel1 is still the same, in portrait taller and in lanscape wider.
 
Last edited:

Peter Simpson

Expert
Licensed User
Longtime User
Hello @Alberto Michelis,
In CameraEx you can set the resolution that you require. For example a photo ratios are usually 4x3, so what I do is I loop through all the resolutions that the camera/phone can use until I reach one that has a ration of 4x3, for example 800x600 is 4x3, but I select a higher resolution that is 4x3. Once you find the resolution that you want to use, you can set CameraEx to use that resolution, for example 1600x1200 etc etc etc.

Your screen preview might still look a bit off (which you can also set if need be), but the photo will look perfect.
 
Upvote 0

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
Problem is not the resolution, may be Im not explaining ok. Problem is, with the same resolution, in portrait mode you se the camera image taller and changing to landscape mode you see it wider.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Problem is not the resolution, may be Im not explaining ok. Problem is, with the same resolution, in portrait mode you se the camera image taller and changing to landscape mode you see it wider.

Okay I've got you, I've not got my laptop on me at the moment but if my memory servers me correctly, what I do is rotate the bitmap, something like this before saving re-saving the image.

B4X:
If ChkBoxSaveRotated.Checked Then BmpPhoto = BmpPhoto .Rotate(270) Else BmpPhoto = BmpPhoto .Rotate(0)

Enjoy...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…