Package selection guidance compiled from public package information, community data, and project usage.
Bitmap is a lightweight and high-performance Dart package designed for efficient image manipulation on Android and iOS. It enables developers to work with pixel data directly, offering fast operations like scaling, cropping, and color adjustments. Ideal for apps requiring real-time image processing or minimal overhead, it integrates seamlessly into Flutter projects. The library focuses on simplicity and speed, making it suitable for tasks such as image filtering, thumbnail generation, and custom rendering. With minimal dependencies and clear APIs, Bitmap streamlines multimedia workflows without sacrificing performance.
Use cases
Real-time image filtering
Thumbnail generation
Image cropping and resizing
Custom image rendering
On-device photo editing
Key features
High-speed pixel manipulation
Minimal memory footprint
Cross-platform support (Android & iOS)
Simple and intuitive API
Lightweight dependency
Suitable for
Performance-critical image processing
Mobile apps with image editing needs
Developers seeking minimal overhead
Apps requiring on-device image transformations
Flutter projects focused on multimedia utilities
Considerations
Limited to basic image operations
No built-in support for advanced filters
Requires understanding of pixel-level manipulation
Not ideal for complex image analysis
Best suited for simple, fast transformations
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
Flutter Bitmap
A minimalist Flutter package to perform fast bitmaps operations.
The focus here is to provide a cool bitmap manipulation interface.
Bitmap uses the Dart FFI to perform operations such as contrast, brightness, saturation, and exposure.
For now, things like format encoding, EXIF and multi-frame images are not the concern of this package. If that is your need, check image.
Some of the algorithms here are heavily inspired by this awesome lib.
Why this exists?
I started to use dart image to create LetsPicture (cool app, check it out) but since the beginning, I've noticed that the performance was really bad.
Dart image has its own Image format, so between decoding, putting some transformations and then displaying the result on the app you had to convert the image two times (at least).
So this package is just this: We deal bitmaps (duh) and we focus only on Flutter use cases.
bitmap takes some advantages from Flutter:
Every image is decoded to RGBA32 by the framework trough ImageStreamListener, so we can rely on Flutter to do the decoding job;
Dart FFI: we are porting some of our functions to C (or C++) making it blazing fast.
With this package, you can easily take advantage of stuff like compute (Isolates) on only the manipulations you want to free the UI thread of heavy computation.
Flutter has a powerful ColorFilter class (that came from skia) which can be used to put some color corrections when painting stuff on canvas. You can use a matrix to correct color (Some matrix examples here).
Not every color transformation can be done through the matrix, though.
Basic usage
1. Image to Bitmap
Everything is around the Bitmap class. You can get an instance of that from any ImageProvider.
import'package:bitmap/bitmap.dart';
Bitmap bitmap = awaitBitmap.fromProvider(NetworkImage("http://pudim.com.br/pudim.jpg")); // Notice this is an async operation
The Bitmap class has also a helper function buildImage that uses Flutter's decodeImageFromList to build a dart:ui Image.
With an Image, you can paint it in a canvas (in a CustomPainter, for example).
You can also save the image as a .bmp file (get the file content with the .buildHeaded() method).
You can check also the image lib where you can save the image in several formats.
The capability of calling a c (or c++) function from dart can help us a lot in getter better performance times.
Isolates
Most of the manipulations on the bitmap take a long time to be completed. That's is because they have to iterate on every item of the bitmap.
A picture with a 400px width and height sizes will generate a list of 640000 integers. This is a heavy computation.
Those can be expensive. Sou you may use Isolates there to free the UI thread from all of this work.
Check the example app, where the transformations are applied through the compute function.
Important: it is noticed that the performance increases a lot when using release mode on your Flutter App