In my Ionic Project, I am using Capacitor for deployment in mobile platforms.
For capturing an image from device, I am using Capacitor Camera which helps me to get the image in three formats. 1. Base64. 2. DataUrl. 3. FileUri.
onCaptureImage() {
if (!Capacitor.isPluginAvailable('Camera')) {
this._sharedService.showToastMessage(
'Unable To Open Camera', 1000);
return;
}
Plugins.Camera.getPhoto({
quality: 60,
source: CameraSource.Prompt,
correctOrientation: true,
resultType: CameraResultType.DataUrl
})
.then(image => {
const blobImg = this._sharedService.dataURItoBlob(image.dataUrl);
this.myfiles.push(blobImg);
this.urls.push(this.sanitizer.bypassSecurityTrustUrl(image.dataUrl));
})
.catch(error => {
return false;
});
}
From this DataUrl I am using to display the image and for uploading this image, I am converting it into Blob and then sending it through FormData.
Right now the quality is 60, I want the quality as 100. But it hangs the device when we generate DataUrl out of 100 quality image.
I just want to know that is there any way that we can generate FileUri with having quality 100 and also can preview the image without generating Base64 or DataUrl out of it.
Thanks.