FlutterImageCompress class

Image Compress plugin.

Method in the static class will help you to compress images, most methods will return Uint8List.

You can use Image.memory to display image:

Uint8List uint8List;
ImageProvider provider = MemoryImage(uint8List);

or

Uint8List uint8List;
Image.memory(uint8List)

The returned image will retain the proportion of the original image. Compress image will remove its EXIF info. and the result is in jpeg format. Rotation is also supported.

Constructors

FlutterImageCompress()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

showNativeLog bool
no getter
validator → Validator
no setter

Static Methods

compressAndGetFile(String path, String targetPath, {int minWidth = 1920, int minHeight = 1080, int inSampleSize = 1, int quality = 95, int rotate = 0, bool autoCorrectionAngle = true, CompressFormat format = CompressFormat.jpeg, bool keepExif = false, int numberOfRetries = 5}) Future<File?>
From path to targetPath
compressAssetImage(String assetName, {int minWidth = 1920, int minHeight = 1080, int quality = 95, int rotate = 0, bool autoCorrectionAngle = true, CompressFormat format = CompressFormat.jpeg, bool keepExif = false}) Future<Uint8List?>
From asset to Uint8List
compressWithFile(String path, {int minWidth = 1920, int minHeight = 1080, int inSampleSize = 1, int quality = 95, int rotate = 0, bool autoCorrectionAngle = true, CompressFormat format = CompressFormat.jpeg, bool keepExif = false, int numberOfRetries = 5}) Future<Uint8List?>
Compress file of path to Uint8List.
compressWithList(Uint8List image, {int minWidth = 1920, int minHeight = 1080, int quality = 95, int rotate = 0, int inSampleSize = 1, bool autoCorrectionAngle = true, CompressFormat format = CompressFormat.jpeg, bool keepExif = false}) Future<Uint8List>
Compress image from Uint8List to Uint8List.