### Open iOS Example in Xcode (sh) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/CONTRIBUTING.md Shell command to open the iOS example project workspace located within the `image_editor` package in Xcode for development or testing on the iOS platform. ```sh open flutter_image_editor/image_editor/example/ios/Runner.xcworkspace ``` -------------------------------- ### Open macOS Example in Xcode (sh) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/CONTRIBUTING.md Shell command to open the macOS example project workspace located within the `image_editor` package in Xcode for development or testing on the macOS platform. ```sh open flutter_image_editor/image_editor/example/macos/Runner.xcworkspace ``` -------------------------------- ### Conventional Commit Message Examples (log) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/CONTRIBUTING.md Provides examples of commit messages following the Conventional Commits specification, illustrating different types, scopes, and the syntax for indicating breaking changes. ```log feat(android): add image rotation support fix(ios): resolve memory leak in image processing docs: update installation instructions feat!: change API interface BREAKING CHANGE: new API is not compatible with previous versions ``` -------------------------------- ### Initial Project Setup Commands (sh) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/CONTRIBUTING.md Provides the sequence of shell commands required to clone the repository, navigate into the project directory, activate the `melos` tool for monorepo management, and bootstrap the project dependencies. ```sh git clone ``` ```sh cd flutter_image_editor ``` ```sh dart pub global activate melos ``` ```sh melos bootstrap ``` -------------------------------- ### Creating Color Option Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Example of creating a ColorOption, which uses a 5x4 color matrix for color adjustments. ```Dart ColorOption(); ``` -------------------------------- ### Creating Clip Option Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Example of creating a ClipOption to define the rectangular area for cropping the image. ```Dart ClipOption(x:0, y:0, width:1920, height:1920); ``` -------------------------------- ### Creating Flip Option Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Example of creating a FlipOption to specify horizontal and/or vertical flipping. ```Dart FlipOption(horizontal:true, vertical:false); ``` -------------------------------- ### Creating Rotate Option Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Example of creating a RotateOption to specify the rotation degree for the image. ```Dart RotateOption(degree: 180); ``` -------------------------------- ### Setting Output Format in Dart Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Shows how to set the output format for the edited image using OutputFormat. Examples include setting PNG format or JPEG format with a specified quality. ```Dart var outputFormat = OutputFormat.png(); var outputFormat = OutputFormat.jpeg(95); // The 95 is quality of jpeg. ``` -------------------------------- ### Mixing Images with MixImageOption in Dart Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Provides an example function `mix` that loads source and destination images, creates an ImageEditorOption group, adds a MixImageOption with specified position, size, target image, and blend mode, edits the destination image, and updates the UI. ```Dart void mix(BlendMode blendMode) async { final src = await loadFromAsset(R.ASSETS_SRC_PNG); final dst = await loadFromAsset(R.ASSETS_DST_PNG); final optionGroup = ImageEditorOption(); optionGroup.outputFormat = OutputFormat.png(); optionGroup.addOption( MixImageOption( x: 300, y: 300, width: 150, height: 150, target: MemoryImageSource(src), blendMode: blendMode, ), ); final result = await ImageEditor.editImage(image: dst, imageEditorOption: optionGroup); this.image = MemoryImage(result); setState(() {}); } ``` -------------------------------- ### Setting Output Format in Flutter Image Editor (Dart) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Shows how to specify the desired output format for the edited image using the OutputFormat class. Examples are provided for creating PNG and JPEG formats, including setting the quality for JPEG output. ```Dart var outputFormat = OutputFormat.png(); var outputFormat = OutputFormat.jpeg(95); // The 95 is quality of jpeg. ``` -------------------------------- ### Mixing Images with Blend Mode in Flutter Image Editor (Dart) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Provides an example function demonstrating how to load source and destination images, configure an ImageEditorOption with a MixImageOption specifying position, size, target image source, and a BlendMode, and then process the image using ImageEditor.editImage. Mentions supported blend modes. ```Dart void mix(BlendMode blendMode) async { final src = await loadFromAsset(R.ASSETS_SRC_PNG); final dst = await loadFromAsset(R.ASSETS_DST_PNG); final optionGroup = ImageEditorOption(); optionGroup.outputFormat = OutputFormat.png(); optionGroup.addOption( MixImageOption( x: 300, y: 300, width: 150, height: 150, target: MemoryImageSource(src), blendMode: blendMode, ), ); final result = await ImageEditor.editImage(image: dst, imageEditorOption: optionGroup); this.image = MemoryImage(result); setState(() {}); } ``` -------------------------------- ### Manually Tag and Publish Version (sh) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/CONTRIBUTING.md Shell commands to manually create a Git tag for a specific package version using the format `-v` and push the tags to trigger the publication workflow to pub.dev. ```sh git tag -v ``` ```sh git tag image_editor-v1.4.0 ``` ```sh git push --tags ``` -------------------------------- ### Configuring Image Editor Options Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Demonstrates how to create an ImageEditorOption object and add various editing options like Flip, Clip, and Rotate, and set the output format. ```Dart final editorOption = ImageEditorOption(); editorOption.addOption(FlipOption()); editorOption.addOption(ClipOption()); editorOption.addOption(RotateOption()); editorOption.addOption(); // and other option. editorOption.outputFormat = OutputFormat.png(88); ``` -------------------------------- ### Available ImageEditor Methods Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md List of static methods provided by the ImageEditor class for different image editing scenarios, handling both Uint8List and File inputs, and returning either Uint8List or File outputs. ```dart ImageEditor.editImage(); ImageEditor.editFileImage(); ImageEditor.editFileImageAndGetFile(); ImageEditor.editImageAndGetFile(); ``` -------------------------------- ### Creating ImageEditorOption Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Instantiate ImageEditorOption and add various editing options to configure the image processing pipeline with desired transformations like flip, clip, and rotate. Also shows setting the output format. ```dart final editorOption = ImageEditorOption(); editorOption.addOption(FlipOption()); editorOption.addOption(ClipOption()); editorOption.addOption(RotateOption()); editorOption.addOption(); // and other option. editorOption.outputFormat = OutputFormat.png(88); ``` -------------------------------- ### Initializing ScaleOption in Dart Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Initializes a ScaleOption object for image scaling. It takes width and height, with optional parameters `keepRatio` and `keepWidthFirst` to maintain aspect ratio and prevent deformation. ```Dart ScaleOption(width, height, keepRatio: keepRatio, keepWidthFirst: keepWidthFirst); ``` -------------------------------- ### Using ColorOption Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Create a ColorOption instance to apply a color matrix transformation to the image. The matrix follows the 5x4 format used in Android graphics. ```dart ColorOption(); ``` -------------------------------- ### Using ClipOption Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Create a ClipOption instance to define the rectangular area (x, y, width, height) for cropping the image. ```dart ClipOption(x:0, y:0, width:1920, height:1920); ``` -------------------------------- ### Adding Image Editor Dependency Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Add the image_editor package to your project's pubspec.yaml file to include it as a dependency. Replace `$latest` with the actual version number. ```YAML dependencies: image_editor: $latest ``` -------------------------------- ### Available Image Editor Methods Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md List of static methods available in the ImageEditor class for performing image editing operations on Uint8List data or File objects. ```Dart ImageEditor.editImage(); ImageEditor.editFileImage(); ImageEditor.editFileImageAndGetFile(); ImageEditor.editImageAndGetFile(); ``` -------------------------------- ### Using FlipOption Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Create a FlipOption instance to specify whether to flip the image horizontally, vertically, or both. ```dart FlipOption(horizontal:true, vertical:false); ``` -------------------------------- ### Configuring Scale Option in Flutter Image Editor (Dart) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Demonstrates how to create a ScaleOption object to resize an image. It explains the optional `keepRatio` and `keepWidthFirst` parameters used to maintain aspect ratio and prevent deformation, detailing their behavior based on the provided table. ```Dart ScaleOption(width, height, keepRatio: keepRatio, keepWidthFirst: keepWidthFirst); ``` -------------------------------- ### Opening Xcode Workspace - Shell Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md This command opens the Xcode workspace for the iOS part of a Flutter project, allowing access to project settings and assets like the launch screen. ```Shell open ios/Runner.xcworkspace ``` -------------------------------- ### Conventional Commit Message Format (log) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/CONTRIBUTING.md Defines the required structure for commit messages according to the Conventional Commits specification, including type, optional scope, description, optional body, and optional footers. ```log [optional scope]: [optional body] [optional footer(s)] ``` -------------------------------- ### Generate Changelog and Bump Version (sh) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/CONTRIBUTING.md Shell command using the `melos` tool to automatically generate the CHANGELOG file and increment the project's version based on the conventional commit messages. ```sh melos version ``` -------------------------------- ### Importing Image Editor Package Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Import the necessary package to use the ImageEditor class and related options in your Dart code. ```Dart import 'package:image_editor/image_editor.dart'; ``` -------------------------------- ### Push Git Changes and Tags (sh) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/CONTRIBUTING.md Shell commands to push local commits and associated tags to the remote Git repository on GitHub, typically performed after a version bump or release. ```sh git push ``` ```sh git push --tags ``` ```sh git push --follow-tags ``` -------------------------------- ### Adding Text with AddTextOption in Dart Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Demonstrates how to create an AddTextOption and add text using EditorText. It shows setting text properties like offset, content, font size, color, and font name. ```Dart final textOption = AddTextOption(); textOption.addText( EditorText( offset: Offset(0, 0), text: this._controller.text, fontSizePx: size, color: Colors.red, fontName: '', // You must register font before use. If the fontName is empty string, the text will use default system font. ), ); ``` -------------------------------- ### Import image_editor Package Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Import the necessary package to use the ImageEditor functionality in your Dart code. ```dart import 'package:image_editor/image_editor.dart'; ``` -------------------------------- ### Add image_editor Dependency Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Add the image_editor package to your pubspec.yaml file to include it in your Flutter project dependencies. ```yaml dependencies: image_editor: $latest ``` -------------------------------- ### Adding Text to Image in Flutter Image Editor (Dart) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Shows how to initialize an AddTextOption and add text using EditorText. It details the parameters for positioning (offset in pixels), text content, font size (fontSizePx in pixels), color, and font name. Notes that units are pixels. ```Dart final textOption = AddTextOption(); textOption.addText( EditorText( offset: Offset(0, 0), text: this._controller.text, fontSizePx: size, color: Colors.red, fontName: '', // You must register font before use. If the fontName is empty string, the text will use default system font. ), ); ``` -------------------------------- ### Implementing ImageEditorPlatform Interface in Dart Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor_platform_interface/README.md This snippet demonstrates how to create a custom implementation of the ImageEditorPlatform interface in Dart. It shows a basic class extending the interface and a static method to register this custom implementation as the default instance for the plugin. ```Dart import 'dart:io'; import 'dart:typed_data'; import 'package:image_editor_platform_interface/image_editor_platform_interface.dart'; class MyImageEditor extends ImageEditorPlatform { static void registerWith() { ImageEditorPlatform.instance = MyImageEditor(); } // ... other methods } ``` -------------------------------- ### Merging Images with ImageMerger in Dart Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md This snippet demonstrates how to use the ImageMerger class to combine multiple images. It sets up a canvas size, defines an output format, adds the same image multiple times at different positions and sizes, performs the merge operation, and updates a MemoryImage provider with the result. ```Dart final slideLength = 180.0; final option = ImageMergeOption( canvasSize: Size(slideLength * count, slideLength * count), format: OutputFormat.png(), ); final memory = await loadFromAsset(R.ASSETS_ICON_PNG); for (var i = 0; i < count; i++) { option.addImage( MergeImageConfig( image: MemoryImageSource(memory), position: ImagePosition( Offset(slideLength * i, slideLength * i), Size.square(slideLength), ), ), ); } for (var i = 0; i < count; i++) { option.addImage( MergeImageConfig( image: MemoryImageSource(memory), position: ImagePosition( Offset( slideLength * count - slideLength * (i + 1), slideLength * i), Size.square(slideLength), ), ), ); } final result = await ImageMerger.mergeToMemory(option: option); provider = MemoryImage(result); setState(() {}); ``` -------------------------------- ### Registering and Using Custom Font in Dart Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md Shows how to register a custom font file using FontManager and then use the registered font name when adding text with EditorText. An empty fontName string uses the system font. ```Dart File fontFile = File(path)//; final String fontName = await FontManager.registerFont(fontFile); // The fontName can be use in EditorText. // If you want to use system font, you can use empty string. final textOption = AddTextOption(); textOption.addText( EditorText( offset: Offset(0, 0), text: this._controller.text, fontSizePx: size, color: Colors.red, fontName: fontName, // You must register font before use. ), ); ``` -------------------------------- ### Merging Images with ImageMerger in Dart Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/README.md This snippet demonstrates how to use ImageMergeOption to define a canvas, add multiple images with specified positions and sizes using MergeImageConfig and ImagePosition, and then merge them into a single image in memory using ImageMerger.mergeToMemory. The resulting image is then used to update a MemoryImage provider. ```dart final slideLength = 180.0; final option = ImageMergeOption( canvasSize: Size(slideLength * count, slideLength * count), format: OutputFormat.png(), ); final memory = await loadFromAsset(R.ASSETS_ICON_PNG); for (var i = 0; i < count; i++) { option.addImage( MergeImageConfig( image: MemoryImageSource(memory), position: ImagePosition( Offset(slideLength * i, slideLength * i), Size.square(slideLength), ), ), ); } for (var i = 0; i < count; i++) { option.addImage( MergeImageConfig( image: MemoryImageSource(memory), position: ImagePosition( Offset( slideLength * count - slideLength * (i + 1), slideLength * i), Size.square(slideLength), ), ), ); } final result = await ImageMerger.mergeToMemory(option: option); provider = MemoryImage(result); setState(() {}); ``` -------------------------------- ### Registering and Using Custom Font in Flutter Image Editor (Dart) Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Illustrates how to register a custom font file using FontManager.registerFont and then apply the registered font name to an EditorText object within an AddTextOption. Explains that an empty fontName string uses the default system font. ```Dart File fontFile = File(path)//; final String fontName = await FontManager.registerFont(fontFile); // The fontName can be use in EditorText. // If you want to use system font, you can use empty string. final textOption = AddTextOption(); textOption.addText( EditorText( offset: Offset(0, 0), text: this._controller.text, fontSizePx: size, color: Colors.red, fontName: fontName, // You must register font before use. ), ); ``` -------------------------------- ### Using RotateOption Source: https://github.com/fluttercandies/flutter_image_editor/blob/main/image_editor/README.md Create a RotateOption instance to specify the rotation degree for the image. The rotation is applied clockwise. ```dart RotateOption(degree: 180); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.