Currently i try to get picture from custom view with Camera Preview, but the result is picture always original size. here my code..
RunCamera() {
let quarter = window.screen.height / 4, mid = quarter + (quarter/2)
const cameraPreviewOpts: CameraPreviewOptions = {
x: 0,
y: this.mid,
width: window.screen.width,
height: 70,
camera: 'rear',
tapPhoto: true,
previewDrag: true,
toBack: true,
alpha: 1
}
// start camera
this.cameraPreview.startCamera(cameraPreviewOpts).then(
(res) => {
console.log("startCamera ok",res)
},
(err) => {
console.log("startCamera Err",err)
});}
Camera will run like bellow.. this run well..
after this, i need to take picture, but the result is like this..
Here my code..
takePic(){
// picture options
const pictureOpts: CameraPreviewPictureOptions = {
width: 1280,
height: 1280,
quality: 85
}
// take a picture
this.cameraPreview.takePicture(pictureOpts).then((imageData) => {
console.log("takePicture",imageData);
this.selectedImage = 'data:image/png;base64,' + imageData;
this.cameraPreview.stopCamera();
}, (err) => {
console.log(err);
alert("Error occured while taking picture:"+JSON.stringify(err))
});}
There is anyway to get my goal ?