I develop app where I want to take photo only on the middle square but by keeping the preview on almost the whole screen like in this picture.
However, the imageproxy, after a cropping, does not look like the previous image, the width and height are bigger.
I notice that what I see with my app and with the device photo app is a bit different, my app seems to zoom a little.
What I've already try:
setViewPort
with the middle view sizesetTargetAspectRatio(AspectRatio.RATIO_4_3)
to both ImageCapture and Preview- add a TextureView or SurfaceView or even another Preview in replacement of the middle view. That was good but I lost the transparency
- one of the best solution was to add
app:layout_constraintDimensionRatio="3:4"
to the xml layout of the preview. But again I lost the transparency (the preview height was 4/3 higher than the width, and above and below, I had white banners.
So why the preview is different of the device camera's one ? Do you know a solution to set the preview on the whole screen but keep only a square center image ?