Height and Width being ignored in Take Picture
See original GitHub issueI 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:
- Created 6 years ago
- Comments:17 (9 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.
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.