-
Notifications
You must be signed in to change notification settings - Fork 51
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
Square preview #3
Comments
To implement the square preview, you may need to take some other views to cover the original rectangle to make the center preview looks like square, but the finally retrieve pixels still in rectangle, so I think the best way is manually clip the |
Ok, I found a solution. |
Hi, I am having the same problem, but I would like to know why this isn't working.
|
Finally solved my problem, I was using FrameLayout instead of TextureView.
And I got a Square Textureview! Hope this help somone. |
Can you post a full sample for your square preview ? |
You only need SquaredTextureview, I also need SquaredFrameLayout because I have to place ImageButtons over the camera preview. |
And this is the code to make the Final Taken Picture SQUARED and CENTERED!
|
Ohh nice. |
Do you have any settings about the size of the preview ? Plus, the code cause a crash |
I understand that the preview is ugly since we can only work with the supported preview sizes which are different on every device. Also the devices preview sizes are not intended to be Square. The most appropriate is not 16:9 (1080x1920) but 4:3 (1080x1440). Even there, the image is not Square at all. I will have to Crop the bitmap manually again, but now it is for the preview. And about the Crash, I think it crashes with:
That happens because the Image width/height is greater than the height of bitmap to save.
with this
Obviously the image will be "less centered" on High-res devices, but prevents to crash on Lower-res devices. Here it is conveniently to detect the preview resolution and apply the appropriate mathematical operation. |
How to get a square preview. I had tried with a square textureview. Does not work well.
The text was updated successfully, but these errors were encountered: