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

前端 未结 4 1637
渐次进展
渐次进展 2021-02-13 14:21

My question is very simple:

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

4条回答
  •  花落未央
    2021-02-13 14:55

    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

提交回复
热议问题