ランキングに戻る

brendan-duncan/image

Dart

Dart Image Library for opening, manipulating, and saving various different image file formats.

dartlangimageimage-processingjpegpngwebpdartdart-librarydart-packagedart-webflutter
スター成長
スター
1.3k
フォーク
302
週間成長
Issue
52
5001k
2014年1月2018年3月2022年5月2026年7月
README

Dart Image Library

Dart CI pub package

Overview

The Dart Image Library provides the ability to load, save, and manipulate images in a variety of image file formats.

The library can be used with both dart:io and dart:html, for command-line, Flutter, and web applications.

NOTE: 4.0 is a major revision from the previous version of the library.

Documentation

Supported Image Formats

Read/Write

  • JPG
  • PNG / Animated PNG
  • GIF / Animated GIF
  • BMP
  • TIFF
  • TGA
  • PVR
  • ICO
  • (Read) WebP / Animated WebP, (Write) Lossless WebP

Read Only

  • PSD
  • EXR
  • PNM (PBM, PGM, PPM)

Write Only

  • CUR

Examples

Create an image, set pixel values, save it to a PNG.

import 'dart:io';
import 'package:image/image.dart' as img;
void main() async {
  // Create a 256x256 8-bit (default) rgb (default) image.
  final image = img.Image(width: 256, height: 256);
  // Iterate over its pixels
  for (var pixel in image) {
    // Set the pixels red value to its x position value, creating a gradient.
    pixel..r = pixel.x
    // Set the pixels green value to its y position value.
    ..g = pixel.y;
  }
  // Encode the resulting image to the PNG image format.
  final png = img.encodePng(image);
  // Write the PNG formatted data to a file.
  await File('image.png').writeAsBytes(png);
}

To asynchronously load an image file, resize it, and save it as a thumbnail:

import 'package:image/image.dart' as img;

void main(List<String> args) async {
  final path = args.isNotEmpty ? args[0] : 'test.png';
  final cmd = img.Command()
    // Decode the image file at the given path
    ..decodeImageFile(path)
    // Resize the image to a width of 64 pixels and a height that maintains the aspect ratio of the original. 
    ..copyResize(width: 64)
    // Write the image to a PNG file (determined by the suffix of the file path). 
    ..writeToFile('thumbnail.png');
  // On platforms that support Isolates, execute the image commands asynchronously on an isolate thread.
  // Otherwise, the commands will be executed synchronously.
  await cmd.executeThread();
}
関連リポジトリ
Solido/awesome-flutter

An awesome list that curates the best Flutter libraries, tools, tutorials, articles and more.

Dartflutterawesome-list
60.7k6.9k
iampawan/FlutterExampleApps

[Example APPS] Basic Flutter apps, for flutter devs.

Dartflutterflutter-apps
21.5k3.8k
CarGuo/gsy_github_app_flutter

Flutter 超完整的开源项目,功能丰富,适合学习和日常使用。GSYGithubApp 系列的优势:我们目前已经拥有 Flutter、Weex、ReactNative、Kotlin View、Kotlin Jetpack Compose ,Compose MultiPlatform,Harmony ArkUI 七个版本,功能齐全,项目框架内技术涉及面广,完成度高,持续维护,配套文章,适合全面学习,对比参考。

DartApache License 2.0flutterflutter-ui
juejin.im/user/582aca2ba22b9d006b59ae68/posts
15.5k2.6k
felangel/bloc

A predictable state management library that helps implement the BLoC design pattern

DartMIT Licenseflutterdart
bloclibrary.dev
12.5k3.4k
nisrulz/flutter-examples

[Examples] Simple basic isolated apps, for budding flutter devs.

DartApache License 2.0dartlangdart
nisrulz.com/flutter-examples/
7.1k1.6k
samarthagarwal/FlutterScreens

A collection of Screens and attractive UIs built with Flutter ready to be used in your applications. No external libraries are used. Just download, add to your project and use.

Dartflutterdart
6k1.4k
ionicfirebaseapp/getwidget

Most popular and easy to use open source UI library with 1000+ Widgets to build flutter app.

DartMIT Licenseflutterdart
getwidget.dev
4.8k646
roughike/inKino

A multiplatform Dart movie app with 40% of code sharing between Flutter and the Web.

DartApache License 2.0dartdartlang
inkino.app
3.7k697
jogboms/flutter_spinkit

✨ A collection of loading indicators animated with flutter. Heavily Inspired by http://tobiasahlin.com/spinkit.

DartMIT Licenseflutterflutter-plugin
3.1k322
BayesWitnesses/m2cgen

Transform ML models into a native code (Java, C, Python, Go, JavaScript, Visual Basic, C#, R, PowerShell, PHP, Dart, Haskell, Ruby, F#, Rust) with zero dependencies

PythonPyPIMIT Licensemachine-learningscikit-learn
3k264
singerdmx/flutter-quill

Rich text editor for Flutter

DartMIT Licensequillreactquill
pub.dev/packages/flutter_quill
2.9k1k
authpass/authpass

AuthPass - Password Manager based on Flutter for all platforms. Keepass 2.x (KDBX 3 and KDBX 4) compatible.

DartGNU General Public License v3.0flutterpassword-manager
authpass.app
2.7k273