I am trying to convert images / textures (for SpriteKit) to grayscale using CoreImage in Swift:
I found this answer: https://stackoverflow.com/a/4646262/232632 which is trying to convert to swift for iOS7 / 8
But kCGImageAlphaNonedoes not exist. I can use it instead CGImageAlphaInfo.None, but the function is CGBitmapContextCreate()not like as the last parameter. I must use enum CGBitmapInfo, but there is no equivalent inside kCGImageAlphaNone.
This is the full line with the wrong parameter (last):
var context = CGBitmapContextCreate(nil, UInt(width), UInt(height), 8, 0, colorSpace, kCGImageAlphaNone)
I just need a way to convert UIImage to grayscale in Swift.
source
share