-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save Image orientation #4
Comments
I am sorry but I am not sure about what you mean. Please clarify the below 2 questions: (1) Does your activity fixed in portrait mode? |
|
I cannot reproduce this. And actually the device orientation is detected using sensors. If in case your device's sensor is broken / does not even have a sensor, the orientation will not work. May I know your device model? |
For example, I have taken a picture in landscape mode so image saved in that orientation means landscape. But I need that image in 90 degrees just like a taken picture in portrait mode. |
That's why I asked the 1st question first. "Taken a picture in landscape mode" can mean "The activity is landscape" or "The device is held in landscape". Which one do you mean? |
Camera activity is in portrait mode but when we change our device orientation for click the photo in camera view then photo clicked in that orientation. |
Hmmm.... I don't understand (in the sense of language) what do you mean by "for click the photo in camera view then photo clicked in that orientation"... Is it possible for you to perform a screen recording? |
Arrrrrrrrrrrr I finally got what you mean!!!!! |
You mean, you want to take the photo when you hold your device in landscape, So now the library will return a different orientation to you. So when you save the photo, the image has a longer width than height; but you still want to save the photo with shorter width than height, even if it does not look like what you see in the camera preview. Am I correct? (hmmm But this does not match what your screencap means) |
I am attaching one image. This image there are two images I have set at bottom of camera view the 1st image I have a click in the portrait mode it's perfect. A 2ed image I have click landscape and it's save in landscape. but now I want to save 2ed image same as the 1st image. means whatever mode you have click but we save 1st ways to save our image. |
Are you understand my point? Can you use your mobile default camera and take picture landscape and portrait then view in a gallery clicked images. Is it possible in this library? I have a check in Whatsup application it's work perfect. |
So this is a perfectly normal use case... Try to use debugger and add a breakpoint to Can you observe the value of If not, please tell me your device model. If yes, this means you haven't implement your code to rotate the image to the orientation you want before saving it. |
My device model is Moto g4 Plus. I tried and debugger on onPictureTaken. I am get rotationDegrees value -90 every time form both orientations. |
Hmm. Strange. Do you have other device to try? I want to try to find out if it is the problem of the model only. I cannot reproduce this on all my devices. And may you also post your related code, all from |
Yes, I tested in HTC One M9PLUS device and in this, it worked fine also changed rotation degrees value.
what about Moto g4 Plus? can you find any solution in library code? |
I am afraid I can do nothing, given that the rotation degrees are originated directly from sensor; what I can conclude is the sensor is not working on your phone; or Moto g4 Plus simply not support it (Not likely). |
In this library, it works perfectly in Moto g4 Plus I think it's helpful to you please find below URL. Please try to optimize code using this library it's very helpful to me. thank you. |
The way I handle orientation is not the same as the library you mentioned. That library does not involve using sensor to detect orientation. Before I changed to using sensor, I used the default method provided by the original google's CameraView; but I found that it does not work in some devices that I have. Therefore I am not falling back to using the old method since it will break some of the good results in some devices that I already have. I suggest you try fotoapparat. I think it is good enough as long as you do not need to use the frames. But I am not sure if they implement orientation using sensor as well. |
Same issue I have found in the SM-T231 device. I try Fotoapparat it will work in Moto g4 plus and HTC One M9PLUS device. but in the SM-T231 device, not view camera as well as orientation issue. |
I have searched SM-T231 on the internet and it seems it only has accelerometer but no magnetometer. I think that's why the orientation is not working. And then I tried to search specs of Moto G4 Plus as well, and it looks like it does not have magnetometer either. I did not realize that so many devices do not have a magnetometer but Android official document is telling people to use magnetometer to detect orientation....... I will try to implement a different way to detect orientation in the future. But I might not have enough time recently... See if you can wait. Thanks for your report! |
@jackeykabra I have rewritten the way of detecting orientation, but I don't have a device which does not have a magnetometer (compass) to test. Could you help trying again using 0.9.5? |
@siralam I have changed the code as you gave but it has not resolved in Moto g4. |
Hm.. Guess I have no other way to solve it then until I have a device without compass on hand. Sorry about that, I will mark a help wanted label here first. |
Hello Siralam,
I have used your custom camera library it is working nice and perfect but my QA has found one issue. it does not issue from your side but I want to get this type of functionality in your library.
When we click native camera image in portrait mode you will be got perfect as the 90-degree image but
in your library, it perfectly works and reveals 90-degree.
but when we click native camera image in landscape mode you will be got perfect as the 90-degree image but in your library, it not reveals 90-degree it displays another degree image. I am giving screenshot what am I getting and what I want.
I think you will understand my point. I want to 90-degree capture pictures save in sd card from landscape or portrait mode.
I changed code in "CameraViewImpl.class", but no effect to "CameraActivity.java" files
like :
cameraView.setOnPictureTakenListener(new CameraViewImpl.OnPictureTakenListener() {
@OverRide
public void onPictureTaken(Bitmap bitmap, int rotationDegrees) {
startSavingPhoto(bitmap, rotationDegrees);
}
});
in this method every time I am getting rotationDegrees = -90 value.
I don't know I am wrong or right can you please help me with this solution.
Whatever mode we click image we save the 90-Degree image. Thank you in advance.
The text was updated successfully, but these errors were encountered: