Member-only story
Image Compression in Flutter
Inspired by this Stack Overflow post
For an app that deals heavily with uploading and downloading images from a server, file size can make or break the user experience. Large files will take longer to save, display, and manipulate, all of which will affect the app’s network performance. Depending on how image-heavy the application is, users may spend more time staring at loading screens than actually interacting with content.
The HTTP Archive has some interesting data on how often mobile applications and websites request images, as well as the average size of those images. To summarize the trends shown there, single web and mobile pages seem to be requesting fewer but larger images than they were three years ago.
In this article, I want to focus on the image size metric. As you can see, the median image size for mobile applications is ~900 KB. If the images you’re throwing around are larger than this, you can expect slower performances and lower user satisfaction. Below, I will show you several methods to compress images before saving them so that your app stays speedy.
TLDR; The flutter_image_compress package is simple and shrinks files more than the ImagePicker class