カテゴリー・パッケージ・リポジトリを検索

パッケージ詳細v4.12.0

image

Dart Image Library は、サーバーおよび Web アプリケーションがさまざまな画像ファイル形式の画像を読み込み、操作し、保存できる機能を提供します。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
895万
いいね数
1760
Pub ポイント
160

パッケージをインストール

flutter pub add image

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Dart イメージライブラリは、サーバーアプリケーションおよびウェブアプリケーションが複数の形式の画像を読み込み、操作し、保存できるようにします。リサイズ、クロッピング、色調調整、フォーマット変換などの一般的な操作をサポートしており、ネイティブプラットフォームツールに依存せずに画像処理タスクに最適です。このライブラリは軽量で、Android、iOS、Web、macOS、Windows、Linux の Flutter アプリで使用することを目的としています。バックエンドでの画像変換や動的にサムネイルを生成する場合に特に有用です。

用途

  • 画像のリサイズとクロッピング
  • サムネイルの生成
  • 画像形式の変換
  • サーバーサイド画像処理
  • Webアプリケーションにおける動的画像操作

主な機能

  • 複数の画像形式をサポートしています
  • クロスプラットフォーム互換性
  • 軽量で高速
  • 組み込み画像フィルター
  • 拡張可能な画像処理パイプライン

適している対象

  • バックエンド画像処理
  • ウェブベースの画像ツール
  • 画像操作が必要なFlutterアプリ
  • 自動化画像ワークフロー
  • 画像編集機能を開発している開発者

注意事項

  • リアルタイムUIレンダリングに最適化されていません
  • 高度な画像エフェクトに対するサポートが限定的
  • 大容量ファイルの手動処理が必要
  • 組み込みキャッシュなし
  • インタラクティブでない画像タスクに最適

元の README

関連するソースリポジトリの 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
  • WebP / Animated WebP (lossless and lossy)

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();
}

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

ランキング