Pro Image Editor 是一個 Flutter 套件,為在 Flutter 應用程式中編輯影像提供無縫且使用者友善的介面。它支援基本的編輯功能,例如裁切、旋轉、調整亮度、對比度和飽和度,非常適合需要隨時隨地進行影像增強的應用程式。此套件相容於 Android、iOS、Web、macOS、Windows 和 Linux 等多個平台,確保廣泛的覆蓋範圍。透過直覺的操作與高效能表現,讓開發者能夠輕鬆整合強大的影像編輯功能,而無需進行大量的自訂開發。
適用情境
行動應用程式照片編輯
基於網路的圖像自定義
跨平台圖像增強工具
社群媒體內容創作
電子商務產品圖像編輯
主要特色
裁剪和旋轉工具
亮度、對比度和飽和度調整
多平台支援
與 Flutter 的簡單整合
編輯的即時預覽
輕量且高效
適合對象
開發圖像密集型應用的開發者
注重設計的移動或網頁應用
需要快速圖像修改的應用程式
教育或創意工具
內容管理系統
使用建議
僅限基本編輯功能
無高級過濾器或AI增強
需要仔細處理大圖像檔案
可能需要針對高解析度圖像進行額外優化
依賴外部相依性以實現完整功能
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
The ProImageEditor is a Flutter widget designed for image editing within your application. It provides a flexible and convenient way to integrate image editing capabilities into your Flutter project.
🎨 Paint Editor: Draw freehand with various brushes, shapes (like circles and arrows), and apply blur or pixelation for censoring.
🅰️ Text Editor: Add and style text with full customization.
✂️ Crop & Rotate Editor: Crop, flip, and rotate images with ease.
🎛️ Tune Adjustments: Adjust brightness, contrast, saturation, and more.
📸 Filter Editor: Apply custom or predefined image filters.
💧 Blur Editor: Add blur to any part of the image.
😀 Emoji Picker: Quickly insert emojis into your design.
🖼️ Sticker Editor: Add and manage custom image stickers.
🚀 Performance & Architecture
🧵 Multi-Threading
Use isolates for background tasks on native platforms.
Use web workers for background tasks in web environments.
Auto- or manually configure the number of active background processors based on device capabilities.
🛠️ Core Features
🖼️ Flexible Image Input: Load images from memory, assets, files, or network.
🌍 i18n Support: Translate every string in the UI.
🎚️ Per-Editor Configuration: Each module offers extensive customization options.
🧱 Fully Customizable: Swap icons, styles, and widgets for any subeditor.
📐 Helper Lines: Snap and align objects more accurately.
↩️ Undo/Redo support for non-destructive editing.
🔁 Movable Background Image: Position the base image as needed.
🔀 Reorder Layers: Change layer stacking order dynamically.
🎯 Interactive Layers: Select and manipulate each element with precision.
🖌️ Hit Detection: Paint layers support interactive selection.
🔍 Zoom Support: Zoom in/out in both paint and main editor views.
🖱️ Enhanced Desktop UX: Fine-tuned movement and scaling on desktop platforms.
🧲 Multiselect Support: Select multiple elements at once.
🎨 Themes
🪵 Grounded Theme
🧊 Frosted Glass Theme
💬 WhatsApp Theme
🔗 Integration
🤖 AI Assistant: Integrate ChatGPT, Gemini, or other AI models to assist with image editing via smart suggestions or direct commands.
🎥 Video Editor: Seamlessly combine image and video editing workflows.
Setup
Web
Show web setup
If you're displaying emoji on the web and want them to be colored by default (especially if you're not using a custom font like Noto Emoji), you can achieve this by adding the useColorEmoji: true parameter to your flutter_bootstrap.js file, as shown in the code snippet below:
Since v14 the editor is built on material_ui and cupertino_ui, which Flutter is decoupling from the SDK. If your app has not migrated its own MaterialApp yet, hand it the localizations of those packages, otherwise the editor's app bars, dialogs and bottom sheets throw No MaterialLocalizations found:
import'package:material_ui/material_ui.dart'as material_ui;
MaterialApp(
localizationsDelegates: [
...material_ui.GlobalMaterialLocalizations.delegates,
// Your existing delegates, e.g. the ones from flutter_localizations.
],
// ...
);
Usage
import'package:pro_image_editor/pro_image_editor.dart';
@overrideWidgetbuild(BuildContext context) {
returnProImageEditor.network(
'https://picsum.photos/id/237/2000',
callbacks: ProImageEditorCallbacks(
onImageEditingComplete: (Uint8List bytes) async {
/*
Your code to process the edited image, such as uploading it to your server.
You can choose to use await to keep the loading dialog visible until
your code completes, or run it without async to close the loading dialog immediately.
By default, the image bytes are in JPG format.
*/Navigator.pop(context);
},
/*
Optional: If you want haptic feedback when a line is hit, similar to WhatsApp,
you can use the code below along with the vibration package.
mainEditorCallbacks: MainEditorCallbacks(
helperLines: HelperLinesCallbacks(
onLineHit: () {
Vibration.vibrate(duration: 3);
}
),
),
*/
),
);
}
The editor provides extensive customization options, allowing you to modify text, icons, colors, and widgets to fit your needs. It also includes numerous callbacks for full control over its functionality.
Check out the web demo to explore all possibilities. You can find the example code for all demos here.
Video-Editor
The editor supports full video generation on Android, iOS, and macOS. Support for Windows and Linux is coming soon.
To keep the image editor lightweight, you’ll need to manually add the video player package of your choice. For rendering the video, you can use my package pro_video_editor, which is also used in the example.
An example of how to implement the video editor with a specific video player can be found here, and a simpler example using just the default video_player is available here.
Sponsors
Included Packages
A big thanks to the authors of these amazing packages.