So creating Gray Scale image from UIImage is very simple. There are multiple source codes available. There are only few that works with Transparent Images, the reason being, that the gray scaled image doesn’t translate the alpha information properly.
So here is a quick copy-and-paste code in swift letting you do just that.
So the problem with other solutions is that it doesn’t properly masked the missing alpha components. To fix this simply create the mask from another context, with different CGImageAlphaInfo. And merge it together with CGImageCreateWithMask.
pre class=”lang: swift>
let greyScaledLogo = UIImage(named:”logo”).greyScaled