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

photofilters 표지
패키지 상세v3.0.1

photofilters

이미지에 다양한 유형의 필터를 적용하기 위한 플러터 패키지입니다. 사용자 정의 필터와 하위 필터도 만들 수 있습니다.

AndroidiOSmacOSWindowsLinux
30일 다운로드
758
좋아요
265
Pub 점수
130

패키지 설치

flutter pub add photofilters

패키지 개요

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

Photofilters는 개발자가 앱 내 이미지에 다양한 시각적 필터를 적용할 수 있도록 해주는 플러터 패키지입니다. 내장된 필터와 사용자 정의 필터 생성을 지원하며, 사용자가 고유한 서브필터를 설계할 수 있습니다. 이 패키지는 모바일 및 데스크톱 애플리케이션의 사진 편집 기능에 이상적입니다. 안드로이드, iOS, macOS, Windows, 리눅스에서 모두 지원되며 크로스플랫폼 일관성을 제공합니다. 직관적인 API로 기존 프로젝트에 쉽게 통합할 수 있습니다.

사용 사례

  • 사진 앱에서의 이미지 편집
  • 사용자가 업로드한 사진에 창의적인 효과 추가
  • 사용자 정의 가능한 사진 필터 갤러리 만들기
  • 소셜 미디어 앱 사진 공유 향상
  • 예술적 이미지 변환 도구 만들기

주요 기능

  • 내장 및 사용자 정의 필터 지원
  • 하위 필터 생성 기능
  • 크로스 플랫폼 호환성
  • Flutter와의 간편한 통합
  • 경량이고 성능이 뛰어난 렌더링

적합한 대상

  • 사진 편집 앱을 개발하는 개발자
  • 창의적 도구 제작자
  • 크로스 플랫폼 멀티미디어 애플리케이션
  • 시각적 향상을 원하는 UI 디자이너
  • 실시간 이미지 필터링이 필요한 앱

고려 사항

  • 이미지 처리 기초 이해 필요
  • 사용자 정의 필터 생성에는 시도와 오류가 필요할 수 있습니다
  • 저사양 기기에서는 성능이 다를 수 있습니다
  • 기본 예제를 넘어서는 문서가 제한적입니다
  • 복잡한 필터를 위해 추가 자산 관리가 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Photo Filters package for flutter

A flutter package for iOS and Android for applying filter to an image. A set of preset filters are also available. You can create your own filters too.

Installation

First, add photofilters and image as a dependency in your pubspec.yaml file.

iOS

No configuration required - the plugin should work out of the box.

Android

No configuration required - the plugin should work out of the box.

Example
import 'dart:async';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:path/path.dart';
import 'package:photofilters/photofilters.dart';
import 'package:image/image.dart' as imageLib;
import 'package:image_picker/image_picker.dart';

void main() => runApp(new MaterialApp(home: MyApp()));

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String fileName;
  List<Filter> filters = presetFiltersList;
  File imageFile;

  Future getImage(context) async {
    imageFile = await ImagePicker.pickImage(source: ImageSource.gallery);
    fileName = basename(imageFile.path);
    var image = imageLib.decodeImage(imageFile.readAsBytesSync());
    image = imageLib.copyResize(image, width: 600);
     Map imagefile = await Navigator.push(
      context,
      new MaterialPageRoute(
        builder: (context) => new PhotoFilterSelector(
              title: Text("Photo Filter Example"),
              image: image,
              filters: presetFiltersList,
              filename: fileName,
              loader: Center(child: CircularProgressIndicator()),
              fit: BoxFit.contain,
            ),
      ),
    );
    if (imagefile != null && imagefile.containsKey('image_filtered')) {
      setState(() {
        imageFile = imagefile['image_filtered'];
      });
      print(imageFile.path);
    }
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('Photo Filter Example'),
      ),
      body: Center(
        child: new Container(
          child: imageFile == null
              ? Center(
                  child: new Text('No image selected.'),
                )
              : Image.file(imageFile),
        ),
      ),
      floatingActionButton: new FloatingActionButton(
        onPressed: () => getImage(context),
        tooltip: 'Pick Image',
        child: new Icon(Icons.add_a_photo),
      ),
    );
  }
}

UI Screen Shots

Sample Images of Filters

No Filter No Filter AddictiveBlue AddictiveBlue AddictiveRed AddictiveRed Aden Aden
Amaro Amaro Ashby Ashby Brannan Brannan Brooklyn Brooklyn
Charmes Charmes Clarendon Clarendon Crema Crema Dogpatch Dogpatch
Earlybird Earlybird 1977 1977 Gingham Gingham Ginza Ginza
Hefe Hefe Helena Helena Hudson Hudson Inkwell Inkwell
Juno Juno Kelvin Kelvin Lark Lark Lo-Fi Lo-Fi
Ludwig Ludwig Maven Maven Mayfair Mayfair Moon Moon
Nashville Nashville Perpetua Perpetua Reyes Reyes Rise Rise
Sierra Sierra Skyline Skyline Slumber Slumber Stinson Stinson
Sutro Sutro Toaster Toaster Valencia Valencia Vesper Vesper
Walden Walden Willow Willow X-Pro II X-Pro II

Sample Images of Convolution Filters

Identity Identity Emboss Emboss Sharpen Sharpen Colored Edge Detection Colored Edge Detection
Blur Blur Edge Detection Medium Edge Detection Medium Edge Detection Hard Edge Detection Hard Guassian Blur Guassian Blur
Low Pass Low Pass High Pass High Pass Mean Mean

Filters

There are two types of filters. ImageFilter and ColorFilter.

Image Filter

Image filter applies its subfilters directly to the whole image one by one. It is computationally expensive since the complexity & time increases as the number of subfilters increases.

You can create your own custom image filter as like this:

    import 'package:photofilters/filters/image_filters.dart';

    var customImageFilter = new ImageFilter(name: "Custom Image Filter");
    customImageFilter.subFilters.add(ConvolutionSubFilter.fromKernel(
      coloredEdgeDetectionKernel,
    ));
    customImageFilter.subFilters.add(ConvolutionSubFilter.fromKernel(
      gaussian7x7Kernel,
    ));
    customImageFilter.subFilters.add(ConvolutionSubFilter.fromKernel(
      sharpenKernel,
    ));
    customImageFilter.subFilters.add(ConvolutionSubFilter.fromKernel(
      highPass3x3Kernel,
    ));
    customImageFilter.subFilters.add(ConvolutionSubFilter.fromKernel(
      lowPass3x3Kernel,
    ));
    customImageFilter.subFilters.add(SaturationSubFilter(0.5));

You can also inherit the ImageFilter class to create another image filter.


class MyImageFilter extends ImageFilter {
  MyImageFilter(): super(name: "My Custom Image Filter") {
    this.addSubFilter(ConvolutionSubFilter.fromKernel(sharpenKernel));
  }
}
Color Filter

Color filter applies its subfilters to each pixel one by one. It is computationally less expensive than the ImageFilter. It will loop through the image pixels only once irrespective of the number of subfilters.

You can create your own custom color filter as like this:

    import 'package:photofilters/filters/color_filters.dart';

    var customColorFilter = new ColorFilter(name: "Custom Color Filter");
    customColorFilter.addSubFilter(SaturationSubFilter(0.5));
    customColorFilter
        .addSubFilters([BrightnessSubFilter(0.5), HueRotationSubFilter(30)]);

You can inherit the ColorFilter class too


class MyColorFilter extends ColorFilter {
  MyColorFilter() : super(name: "My Custom Color Filter") {
    this.addSubFilter(BrightnessSubFilter(0.8));
    this.addSubFilter(HueRotationSubFilter(30));
  }
}

Sub filters

There are two types of subfilters. One can be added to the ColorFilter and the other can be added to the ImageFilter. You can inherit ColorSubFilter class to implement the former and you can use the ImageSubFilter mixin to implement the latter. You can create a same subfilter that can be used for both Image and Color Filters. The BrightnessSubFilter is an example of this.

class BrightnessSubFilter extends ColorSubFilter with ImageSubFilter {
  final num brightness;
  BrightnessSubFilter(this.brightness);

  ///Apply the [BrightnessSubFilter] to an Image.
  @override
  void apply(Uint8List pixels, int width, int height) =>
      image_filter_utils.brightness(pixels, brightness);

  ///Apply the [BrightnessSubFilter] to a color.
  @override
  RGBA applyFilter(RGBA color) =>
      color_filter_utils.brightness(color, brightness);
}

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

카테고리

의존성

의존성 목록 3 개

소스 저장소

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