How to resize image using image_editor or any other library. I am used image library, but it gives error:
D/OpenGLRenderer: — Failed to create image decoder with message ‘unimplemented’
How to resize image using image_editor or any other library. I am used image library, but it gives error:
D/OpenGLRenderer: — Failed to create image decoder with message ‘unimplemented’
2
Answers
Just a small tip: I would suggest including the code snippet to show exactly how you try to re-size, so others can explain why the error happens in the first place and help you do it the way you already started doing 🙏
There are multiple ways to do it in Flutter and it is not super clear which exactly you might need (static sizes, dynamic fitting, resizing meaning compression or etc). I assume we talk about image resizing to the static size for its further rendering.
One of them is simply using a
ConstrainedBox
as a parent widget on theImage
.For example ⬇️, just use the path to your own asset instead of
assets/vancouver.jpg
and then tweakmaxHeight
andmaxWidth
if the sizes are static.Hope it works for you!
You can try https://pub.dev/packages/flutter_image_compress this package if you want to save file the small size image file.
The below method of
FlutterImageCompress
package gives an another file according to your needs, you’ve to simply decrease the quality of your image file.You can checkout other methods as well of this package that can help you to achieve your goal.