TakePhoto is not cropped as configured
See original GitHub issueI run my camera preview with a long rectagle:
cameraPreviewOpts: CameraPreviewOptions = {
x: (window.screen.width-150)/2,
y: window.screen.height*0.05,
width: 150,
height: window.screen.height*0.9,
camera: 'rear',
tapPhoto: false,
tapToFocus: true,
previewDrag: true,
toBack: false,
alpha: 1
};
This is good, but when I take a picture of it, the picture has a totally different dimension, even when the configuration is the same:
const pictureOpts: CameraPreviewPictureOptions = {
width: 150,
height: window.screen.height*0.9,
quality: 100
};
that.cameraPreview.takePicture(pictureOpts).then((imageData) => {
that.picture = 'data:image/jpeg;base64,' + imageData;
}, (err) => {
This is the camera ON (this is how I want it)
This is the picture it takes
Issue Analytics
- State:
- Created 6 years ago
- Comments:10
Top Results From Across the Web
Android: Take Picture, then immediately do crop w/o needing ...
i have one question with this solution, I have a custom view setup when I am in the camera activity. Will I be...
Read more >ImagePicker - Expo Documentation
You can configure expo-image-picker using its built-in config plugin if you use ... Cropping multiple images is not supported - this option is...
Read more >ESP32-CAM Take Photo and Save to MicroSD Card
Learn how to take photos with the ESP32-CAM board and save them to a microSD card using Arduino IDE. We'll be using the...
Read more >Taking still photos with getUserMedia() - Web APIs | MDN
This article shows how to use navigator.mediaDevices.getUserMedia() to access the camera on a computer or mobile phone with getUserMedia() ...
Read more >Take a picture using the camera - Flutter documentation
Warning: If you do not initialize the CameraController , you cannot use the ... You can use the CameraController to take pictures using...
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
To attempt to crop the image to match what is seen in the Image Preview, I tried replicating the iOS source code on how the image preview is constructed, using Javascript.
@westonganger What kind of PR would be best to share this knowledge? Should this helper code be included in the README.md with the takePicture documentation?
Here is code I used to take the picture and crop it appropriately.
Here is the implementation I wrote
Testing: This was tested with iPhone 6s, with the default front-facing camera image size (1280x960) and default back-facing image size (4032 x 3024).
@youralien you are an angel … tysm 😃