Camera Surface View Images Look Stretched

android, android-camera

Solution

You need to choose a preview size that matches your display size. I would suggest changing the preview size setting to match your `SurfaceView` rather than the other way around. While the preview data is just fine, it's not distorted, it will look distorted when flung onto a surface with different aspect ratio.

If you have a full-screen view, then you should find the camera has a preview size matching that size -- at the least there will be one with the same aspect ratio. For example if your screen is 640x480 then a 320x240 preview size will not appear stretched on a full-screen `SurfaceView`.

Problem

In portrait mode, the images look vertically stretched and in landscape mode it looks horizontally stretched. Although after capturing the image appears in proper size. How to resolve this issue?

Original source

Related problems