is there any possible way to convert image into png so i can reduce the image size but wont affect my file resolution
i already try using imagePicker quality but surely it will decrease the resolution of the image. this is code that i been used now.
Future _getCameraImage() async {
final image = await ImagePicker()
.pickImage(source: ImageSource.camera, imageQuality: 20);
setState(() {
_image = File(image!.path);
});
}
Future _getGalleryImage() async {
final image = await ImagePicker()
.pickImage(source: ImageSource.gallery, imageQuality: 20);
setState(() {
_image = File(image!.path);
});
}
i set the imagequality and the image became a hard pixel because of it
CodePudding user response:
You can use the maxwidth or maxheight to your current target something look like if you having a 2000 x 1080 image pixels and if you set the maxwidth into 800 it will compress the width into 800. this is the example code that you can use
Future _getCameraImage() async {
final image = await ImagePicker().pickImage(
source: ImageSource.camera,
imageQuality: 20,
maxHeight: 800,
maxWidth: 800);
setState(() {
_image = File(image!.path);
});
}
you can use both of maxwidth or the maxheight and after it resize the imagequality, base on my current code it will give small image size around 15-25kb