Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alann-maulana/image_compression_flutter
A Flutter extension to compress and resize the images (JPG, PNG, WEBP).
https://github.com/alann-maulana/image_compression_flutter
Last synced: about 1 month ago
JSON representation
A Flutter extension to compress and resize the images (JPG, PNG, WEBP).
- Host: GitHub
- URL: https://github.com/alann-maulana/image_compression_flutter
- Owner: alann-maulana
- License: other
- Created: 2021-07-26T03:51:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-15T04:24:56.000Z (9 months ago)
- Last Synced: 2024-02-15T05:25:52.586Z (9 months ago)
- Language: Dart
- Homepage:
- Size: 224 KB
- Stars: 10
- Watchers: 5
- Forks: 17
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Flutter Image Compression
Flutter image compression and resize for Mobile, Desktop and Web. Support format JPG, PNG, WEBP.
Combining use of packages :
* [image_compression](https://pub.dev/packages/image_compression) : `MacOS`, `Windows`, `Linux` and `Web`
* [flutter_image_compress](https://pub.dev/packages/flutter_image_compress) : `Android` and `iOS`## Compressing Image
```dart
ImageFile input; // set the input image file
Configuration config = Configuration(
outputType: ImageOutputType.webpThenJpg,
// can only be true for Android and iOS while using ImageOutputType.jpg or ImageOutputType.pngÏ
useJpgPngNativeCompressor: false,
// set quality between 0-100
quality: 40,
);final param = ImageFileConfiguration(input: input, config: config);
final output = await compressor.compress(param);print("Input size : ${input.sizeInBytes}");
print("Output size : ${output.sizeInBytes}");
```