0 purchases
webp
webp #
Asset transformer for converting images into WebP files.
Install package #
flutter pub add webp
copied to clipboard
Package usage #
Add to your pubspec.yaml.
Default usage #
If run without additional arguments, the default value of the quality parameter = 75 with lossy compression will be used.
flutter:
assets:
- path: assets/logo.jpg
transformers:
- package: webp
copied to clipboard
Usage with params #
flutter:
assets:
- path: assets/logo.jpg
transformers:
- package: webp
args: ['--quality=65', '--hint=graph', '--af']
copied to clipboard
By default, the package runs the embedded precompiled cwebp binary. You can use the one specified in your $PATH by adding the --from_path flag.
flutter:
assets:
- path: assets/logo.jpg
transformers:
- package: webp
args: ['--from_path']
copied to clipboard
cwebp parameters #
Here are some commonly used parameters for cwebp:
-q, --quality: Set the quality factor for the output image. The value should be between 0 and 100, with 100 being the highest quality. For example, --quality=80.
--lossless: Encode the image without any loss. For images with fully transparent area, the invisible pixel values (R/G/B or Y/U/V) will be preserved only if the --exact option is used..
-m, --method: Set the compression method. The value can be 0 (fastest), 1 (default), 2 (slowest), or 3 (best quality). For example, --method=2.
-f, --filter: Set the filter strength. The value can be between 0 and 100, with 0 being no filtering and 100 being maximum filtering. For example, --filter=50.
-s, --size: Set the target size for the output image. The value should be in bytes. For example, --size=500000.
For a complete list of parameters and their descriptions, please refer to the cwebp documentation.
Supported architectures #
The package provides cwebp binaries for the following architectures:
windows-x64,
macos-x64,
macos-arm64,
linux-x64,
linux-arm64.
Note: You can still use the package on other architectures with cwebp from your $PATH.
Learn more #
Asset transformers in Flutter
Built with ☕️ by LeanCode
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.