webp
1.0.1, released 8 months ago by leancode.co
Asset transformer for converting images into WebP files in Flutter apps
What it does
It automatically converts image assets into WebP format during the Flutter build process using precompiled cwebp binaries. You can configure quality, compression methods, filtering, and target sizes directly in your pubspec.yaml.
AI-written summary of version 1.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to optimize your app bundle size by converting asset images to WebP format automatically.
- You want to use custom cwebp quality parameters for specific asset images in Flutter.
Skip it when
- You need to dynamically convert images downloaded from the network at runtime.
- Your target architecture is not supported by the bundled binaries and you cannot provide cwebp in your PATH.
Strengths
- Bundles precompiled cwebp binaries for multiple architectures (Windows, macOS, Linux).
- Integrates seamlessly into the Flutter asset transformation pipeline.
- Allows fine-tuning with cwebp parameters like quality, method, and filter strength.
Weaknesses
- Limited to asset conversion during build time.
- Relies on external cwebp binaries.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Add the package under asset transformers in your pubspec.yaml file.
flutter:
assets:
- path: assets/logo.jpg
transformers:
- package: webp
args: ['--quality=65', '--hint=graph']Alternatives
Packages that do the same job and could replace webp.
- image_cropper
A Flutter plugin for Android, iOS and Web supports cropping images
84Compare - image
Pure Dart library to load, manipulate, encode, and decode various image formats.
96Compare - image_picker
Flutter plugin for selecting images/videos from the gallery and capturing new ones via camera.
94Compare - octo_image
A multifunctional Flutter image widget supporting placeholders, error widgets, and fading.
94Compare
Works with
Packages commonly used together with webp: ones it builds on, ones built on it, and its own family.