Just getting strated with Swift and iOS.
I'm looking to create a dithered version of an image in iOS.
I've captured the image to a UIImageView and have converted to greyscale, with export options to photos.
imagepicked.image = convertToGrayScale(image: image) //make greyscale, working.
imagepicked.image = simpleDitherExample(inputImage: image) //where do I start?
To create a dithered image like this:
I understand that the CIDither isn't available until iOS 13, any options now? Any free iOS libraries I can import and call?
Any help appreciated.
The CIDither filter is actually available as of iOS 12. To use this filter pre iOS 13 (without the convenience of the CIDither protocol), you can do something like the following:
let filterParameters: [String: Any] = [ "inputImage": inputImage, // a CIImage "inputIntensity": 2.0 // numbers in the range of 0.0 to 5.0 are valid ] let ditherFilter = CIFilter(name: "CIDither", parameters: filterParameters)