Skip to content
pubscout

flutter_image_compress

2.5.1, released 4 months ago by fluttercandies.com

Compress pictures using native code to effectively reduce image size.

$ flutter pub add flutter_image_compress
Source repository

What it does

Compresses images using platform-native encoders on Android, iOS, macOS, Web, and OpenHarmony. Exposes methods for files, assets, and raw bytes, returning compressed bytes or files.

AI-written summary of version 2.5.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to reduce image file sizes before uploading them to a server.
  • Dart-based image compression libraries are too slow for your application workloads.

Skip it when

  • You are targeting platforms or formats not supported by the native encoders without fallback handling.

Strengths

  • Dramatically faster than Dart-only image compression libraries.
  • Supports multiple input types including files, asset images, and raw byte lists.
  • Provides controls for quality, dimensions, rotation, and EXIF metadata preservation.

Weaknesses

  • Certain features and formats (like WebP or HEIC) have platform-specific caveats or lack full support.
  • Requires proper initialization when called from a background isolate.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
5

Add the dependency to pubspec.yaml and import the package in your Dart code.

Future<Uint8List?> testCompressFile(File file) async {
  final result = await FlutterImageCompress.compressWithFile(
    file.absolute.path,
    minWidth: 2300,
    minHeight: 1500,
    quality: 94,
    rotate: 90,
  );
  return result;
}

Alternatives

Packages that do the same job and could replace flutter_image_compress.

  • image

    If you need a pure Dart image processing library without native dependencies.

Works with

Packages commonly used together with flutter_image_compress: ones it builds on, ones built on it, and its own family.