Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get an Android Camera2 with 1:1 ratio like Instagram?

My question is very simple:

How to get an Android android.hardware.Camera2 with 1:1 ratio and without deformation like Instagram?

I tested with the GoogeSamples project android-Camera2Basic. But when I change the preview with a ratio of 1:1 image is deformed. Does anyone have an idea on this?

enter image description here

like image 870
lopez.mikhael Avatar asked Jan 06 '16 17:01

lopez.mikhael


1 Answers

For anybody looking for this, I tried the above answer. Adding a margin to hide part of textureview to make it look square looks good in preview. But when saving the image, you should remove the hidden areas from the output image also.

An Easier solution is to show a full textureview and to overlay some other layouts on it to make it look square.You can easily crop the image from output.

you can find the sample code here

like image 196
Tom Saju Avatar answered Nov 01 '22 23:11

Tom Saju