/DDBlackWhite

🎨🚫 Make your image black and white

Primary LanguageSwiftMIT LicenseMIT

DDBlackWhite

Language Platform License Version

Make your image black and white

DDBlackWhite

Installation

CocoaPods

To install DDBlackWhite via CocoaPods, add the following line to your Podfile:

pod 'DDBlackWhite'

After installing the cocoapod into your project import DDBlackWhite with:

import DDBlackWhite

Carthage

To install DDBlackWhite via Carthage, add the following line to your Cartfile:

github "d-dotsenko/DDBlackWhite"

And then run:

carthage update

Manually

Add DDBlackWhite folder to your Xcode project.

Usage

See the example Xcode project.

Basic setup

Create the DDBlackWhite instance, set the inputImage and brightness variables. Call getFilteredImage method and its closure will return the filtered image.

let blackWhite = DDBlackWhite()
blackWhite.inputImage = image
blackWhite.brightness = 0.8
blackWhite.getFilteredImage { (image) in
// filtered image received
}

Populating the data

var inputImage: UIImage?
private(set) var outputImage: UIImage?
var brightness: CGFloat // The filter brightness value (0.0 ... 1.0), Default is 0.5

func getFilteredImage(closure: @escaping (UIImage?)->Void)

Requirements

  • iOS 9.0
  • Xcode 10, Swift 4.2

License

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