question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preview is stretched in width

See original GitHub issue

While the captured image shows the correct aspect ratio, the preview is obviously stretched in width. I’ve tried to set different aspect ratios, e.g. 1/1 or viewFinderWidth/viewFinderHeight to the preview config, as well as transforming the scale of the viewFinder by

matrix.setScale(outputTextureWidth/viewFinderWidth, outputTextureHeight/viewFinderHeight); viewFinder.setTransform(matrix);

but none of this could resolve the issue.

(Capture config was setup with the same values as the preview config, i.e. targetAspectRatio and targetResolution)

Phone: Huawei P9 lite Android: 7.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
saschpecommented, Aug 2, 2019
0reactions
VuManhHung97commented, Oct 7, 2019

Tôi gặp vấn đề tương tự trong ứng dụng tôi đang làm việc, khi tôi nhận thấy ứng dụng CameraX mẫu không gặp vấn đề tương tự, tôi nhận thấy rằng họ đặt chế độ systemUiVisibilitytoàn màn hình, vì vậy tôi đã triển khai nó và giải quyết việc xem trước camera bị kéo dài

    private fun setImmersiveMode() {
        // body is root view in my layout
        body?.systemUiVisibility =
                View.SYSTEM_UI_FLAG_FULLSCREEN or
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
    }

It does not work for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Camera Preview Stretched - Stack Overflow
What needs to be done is to set camera preview layout width and height to match the chosen camera size ratio, so the...
Read more >
Android Camera Preview Stretch Issue | by Vikram Kodag
The root of all issues is the height-width ratio to display the camera preview. Download the Full source code. Happy coding….!! Android.
Read more >
Android Camera Preview Stretch Issue - MindBowser
The most important bug in the Camera Preview Stretch Issue is the ratio given to display a camera preview. So if the preview...
Read more >
Camera - SurfaceView displays stretched preview
CameraSource and it has a method setRequestedPreviewSize(width, ... My problem is that on different devices the preview is stretched.
Read more >
Email Banner Preview Image stretched - Marketing Nation
At a very quick glance, you've probably got contention between the height and width HTML attributes, and the width=100% in the style. Some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found