camera - How to resize image in Ionic 3 without quality reduce and target width and height? -
i want reduce size of images taken camera api quality reduce not good. best thing reduce resolution don't want use target width , height images.
for example, want image width 1280 , image height change automatically ratio, in api should use exact width , height.
how can change height dynamic image ratio???
for now, use code:
this.camera.getpicture({ quality: 60, destinationtype: this.camera.destinationtype.file_uri, sourcetype: sourcetype, mediatype: this.camera.mediatype.picture, targetwidth: 1280, targetheight: 1280, encodingtype: this.camera.encodingtype.jpeg, savetophotoalbum: (source === picturesource.camera), allowedit: true })
i use image resizer native api in camera , works. when value assign width , height turn greater 1 target value , adjust 1 original ratio.. here code:
this.camera.getpicture({ destinationtype: this.camera.destinationtype.file_uri, sourcetype: sourcetype, mediatype: this.camera.mediatype.picture, encodingtype: this.camera.encodingtype.jpeg, savetophotoalbum: (source === picturesource.camera), allowedit: true }) .then(imageuri => { this.imageresizer.resize({ uri: imageuri, quality: 60, width: 1280, height: 1280 }).then(uri => handler(uri)) }) .catch(error => console.warn(error)) }
Comments
Post a Comment