Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rodydavis/image_resizer
Flutter/Dart Image Resize and Generator
https://github.com/rodydavis/image_resizer
dart flutter image-processing resize-images
Last synced: 14 days ago
JSON representation
Flutter/Dart Image Resize and Generator
- Host: GitHub
- URL: https://github.com/rodydavis/image_resizer
- Owner: rodydavis
- License: other
- Created: 2020-02-14T22:06:53.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-27T18:14:52.000Z (over 3 years ago)
- Last Synced: 2024-12-24T00:10:35.839Z (20 days ago)
- Topics: dart, flutter, image-processing, resize-images
- Language: Dart
- Homepage: https://rodydavis.github.io/image_resizer/
- Size: 2.57 MB
- Stars: 13
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Buy Me A Coffee](https://img.shields.io/badge/Donate-Buy%20Me%20A%20Coffee-yellow.svg)](https://www.buymeacoffee.com/rodydavis)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WSH3GVC49GNNJ)
[![Pub](https://img.shields.io/pub/v/image_resizer.svg?style=popout)](https://pub.dartlang.org/packages/image_resizer)# image_resizer
Dart image resizer library for flutter.
It can write to the correct folder locations, create an archive and work across web and io.
Online Demo: https://rodydavis.github.io/image_resizer/
#### Included Folders:
- IosIconsFolder
- WebIconsFolder
- MacOSIconsFolder
- AndroidIconsFolderThis package is also meant to resize images at runtime too, or used for CLI purposes.
## Getting Started
```dart
await _generateIcons('iOS Icons', IosIconsFolder());
await _generateIcons('Web Icons', WebIconsFolder());
await _generateIcons('MacOS Icons', MacOSIconsFolder());
await _generateIcons('Android Icons', AndroidIconsFolder());Future _generateIcons(String key, ImageFolder folder) async {
final _image = image.decodePng(_imageData);
final _gen = IconGenerator();
final _archive =
await _gen.generateIcons(_image, folder, writeToDiskIO: false);
if (mounted)
setState(() {
_files[key] = _archive;
});
}Future _archive() async {
final _gen = IconGenerator();
List _images = [];
for (var key in _files.keys) {
final _folder = _files[key];
_images.addAll(_folder.toList());
}
final _data = _gen.generateArchive(_images);
await saveFile('images.zip', binaryData: _data);
}
```