ZLImageEditor Documentation

repository·master·Indexed 20 days ago

https://github.com/longitachi/zlimageeditor

A Swift-based image editing framework for iOS. It provides tools for drawing, cropping, stickers, mosaics, filters, and color adjustments (brightness, contrast, and saturation) via the ZLEditImageViewController and ZLImageEditorConfiguration.

Tokens
666
Snippets
3
Records
5
Agent score
21%

What's inside ZLImageEditor

  1. Install ZLImageEditor via CocoaPods

    master

    To integrate ZLImageEditor using CocoaPods, add the following to your Podfile:

    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '10.0'
    use_frameworks!
    
    target 'MyApp' do
      pod 'ZLImageEditor'
    end

    Then, execute pod install in your terminal. If you cannot find the latest version, run pod repo update first.

    $ pod install
  2. Install ZLImageEditor via Swift Package Manager

    master
    1. In Xcode, select File > Swift Packages > Add Package Dependency.
    2. Enter https://github.com/longitachi/ZLImageEditor.git in the "Choose Package Repository" dialog.
    3. Set the version resolving rule to "Up to Next Major" with "3.0.0" as the earliest version.
    4. Once resolved, select the ZLImageEditor library and add it to your app target.
  3. Show the image editor using ZLEditImageViewController

    master

    You can present the image editor by configuring the tools available and calling ZLEditImageViewController.showEditImageVC.

    Use ZLImageEditorConfiguration.default() to specify which editing tools (like .draw, .clip, .filter, etc.) and adjustment tools (like .brightness, .contrast, .saturation) are enabled. The completion handler returns the edited image and the editModel used.

    ZLImageEditorConfiguration.default()
        .editImageTools([.draw, .clip, .imageSticker, .textSticker, .mosaic, .filter, .adjust])
        .adjustTools([.brightness, .contrast, .saturation])
    
    ZLEditImageViewController.showEditImageVC(parentVC: self, image: image, editModel: editModel) { [weak self] (resImage, editModel) in
        // your code
    }
  4. Available editing and adjustment tools

    master

    When configuring ZLImageEditorConfiguration, you can enable the following tools:

    Editing Tools (editImageTools):

    • .draw: Graffiti/drawing support.
    • .clip: Cropping support with custom ratios.
    • .imageSticker: Image stickers with custom container views.
    • .textSticker: Text stickers with custom colors.
    • .mosaic: Mosaic effect.
    • .filter: Custom filters.
    • .adjust: Brightness, contrast, and saturation adjustments.

    Adjustment Tools (adjustTools):

    • .brightness
    • .contrast
    • .saturation