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.

Height and Width being ignored in Take Picture

See original GitHub issue

I defined the height and width in my application but the plugin is ignoring it and always outputing the same thing.

`CameraPreview.takePicture({width: 640, height: 640, quality: 85}, (base64Data)=>{

      });`

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
manuelnaranjocommented, Mar 9, 2018

@waitopiggu @Choppe l I tried something similar on my clone, so the problem with that is that given that the aspect ratio of the visualization doesn’t match the aspect ratio of the capture then the captured image could look cropped, or have extra space.

So my solution was, start the camera in a preview area of 0x0 to get the supported camera sizes, then pick the size I’m interested in, then stop the camera again, and restart it in a region that respects the aspect ratio of my capture image.

This flow works perfectly every time, and now the preview and the capture match, and I can even do 16MP images (for this I need a patch that’s not part of the upstream, that requires to store the image into a file instead of base64 as base64 is just too damn expensive).

Right now I’m facing a memory leak, which happens after I take every picture stop the camera then restart it. I may need to add a method that gets the supported sizes for all the cameras without having the camera started, kind of a static method.

1reaction
waitopiggucommented, Feb 21, 2018

I am hitting the same issue in Android. On my device, getOptimalPictureSize() is always returning 720x1280, regardless of the specified width, height and screen orientation.

From what I can tell, since the size variable is overwritten inside the supported sizes loop, my desired width and height are never found.

Eg: Outside of the loop size is set at width = 640, height = 480. Starting the second loop iteration, width = 320, height = 240. Etc.

As @millecker says, the “perfect match” code won’t be hit unless the requested size matches the first supported size.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting Height And Width On Images Is Important Again
It ignored any width and height attributes set in the HTML. The implication of all this is that specifying width and height attributes...
Read more >
img width & height is ignored - SiteOrigin
I used to change image characteristics, using width & height as I needed. But now I see that these values are ignored. An...
Read more >
Image height and width not working? - Stack Overflow
The width and height attributes are being overridden by your stylesheet, so you need to switch to this format. Save this answer.
Read more >
max-width - CSS: Cascading Style Sheets - MDN Web Docs
It prevents the used value of the width property from becoming larger than the ... <length> value */ max-width: 3.5em; /* <percentage> value ......
Read more >
width | CSS-Tricks
Because the caption is very longer than the image is wide (it doesn't take any soft wrap opportunity, like the spaces between words),...
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