Make your image black and white
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
To install DDBlackWhite
via Carthage, add the following line to your Cartfile:
github "d-dotsenko/DDBlackWhite"
And then run:
carthage update
Add DDBlackWhite
folder to your Xcode project.
See the example Xcode project.
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
}
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)
- iOS 9.0
- Xcode 10, Swift 4.2
DDBlackWhite
is available under the MIT license. See the LICENSE file for more info.