Skip to content
This repository has been archived by the owner on Apr 23, 2022. It is now read-only.

tbxark-arc/Watermark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Watermark

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

DispatchQueue.global().async {
    guard let bilibili = UIImage(named: "bilibili"),
        let image = UIImage(named: "demo") else {
        return
    }
    let attr = NSAttributedString(string: "ID:2333333", attributes: [
        NSAttributedStringKey.font : UIFont.boldSystemFont(ofSize: 16),
        NSAttributedStringKey.foregroundColor: UIColor.white])
    let processor =  WatermarkProcessor()
    var layout: WatermarkProcessor.Media.Position = (
        horizontal: (offset: 20, alignment: .end),
        vertical: (offset: 20, alignment: .start)
    )
    processor.addMedia(WatermarkProcessor.Media(image: bilibili, layout: layout))
    layout.vertical.offset += bilibili.size.height + 10
    processor.addMedia(WatermarkProcessor.Media(text: attr, layout: layout))
    guard let result = processor.process(origin: image) else {
        return
    }
    DispatchQueue.main.async {
        self.imageView.image = result
    }
}

Requirements

Installation

Watermark is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Watermark', :git => 'https://github.com/TBXark/Watermark.git'

Author

TBXark, [email protected]

License

Watermark is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published