image_editor

支持 Android 和 iOS,使用原生方式进行图片的翻转、裁剪和旋转。

截图

img

用法

pub package GitHub GitHub stars

导入

import 'package:image_editor/image_editor.dart';

初始插件(必须做)

void main(){
    runApp();
    /// init plugin
    ImageEditor.initialPlugin();
}

// or

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  ImageEditor.initialPlugin();
  runApp(MyApp());
}

// This method initializes a cache directory for subsequent operations, you can call it before you want to use this plugin.

方法列表

ImageEditor.editImage();
ImageEditor.editFileImage();
ImageEditor.editFileImageAndGetFile();
ImageEditor.editImageAndGetFile();

单独使用示例

Example of extended_image

ImageEditor方法参数

名称 描述
image dart.typed_data.Uint8List
文件 dart.io.File
imageEditorOption flutter_image_editor.ImageEditorOption

ImageEditorOption

final editorOption = ImageEditorOption();
editorOption.addOption(FlipOption());
editorOption.addOption(ClipOption());
editorOption.addOption(RotateOption());

选项

翻转

FlipOption(horizontal:true, vertical:false);

剪辑

ClipOption(x:0, y:0, width:1920, height:1920);

旋转

RotateOption(degree: 180);

GitHub

https://github.com/fluttercandies/flutter_image_editor