분류, 패키지 및 저장소 검색

패키지 상세v4.12.0

image

Dart 이미지 라이브러리는 서버 및 웹 앱에서 다양한 이미지 파일 형식의 이미지를 로드하고 조작하며 저장할 수 있는 기능을 제공합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
895만
좋아요
1.8천
Pub 점수
160

패키지 설치

flutter pub add image

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Dart 이미지 라이브러리는 서버 및 웹 애플리케이션에서 여러 형식의 이미지를 로드하고 조작하며 저장할 수 있도록 합니다. 크기 조정, 자르기, 색상 조정 및 포맷 변환과 같은 일반적인 작업을 지원하여 원본 플랫폼 도구에 의존하지 않고 이미지 처리 작업에 적합합니다. 이 라이브러리는 가볍고 Android, iOS, Web, macOS, Windows, Linux에서 Flutter 앱 사용을 위해 설계되었습니다. 백엔드 이미지 변환 또는 동적으로 썸네일 생성에 특히 유용합니다.

사용 사례

  • 이미지 크기 조정 및 자르기
  • 미리보기 생성
  • 이미지 형식 변환
  • 서버 측 이미지 처리
  • 웹 앱에서의 동적 이미지 조작

주요 기능

  • 여러 이미지 형식을 지원합니다
  • 크로스 플랫폼 호환성
  • 가볍고 빠름
  • 내장 이미지 필터
  • 확장 가능한 이미지 처리 파이프라인

적합한 대상

  • 백엔드 이미지 처리
  • 웹 기반 이미지 도구
  • 이미지 조작이 필요한 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

순위