title: How to recolor an image using CoreGraphics?
body: <p>I have a picture in shades of gray. Is it possible to recolor the image in shades of other (arbitrary) color? Something like on the picture below.</p>
  
  <p><img src="https://i.stack.imgur.com/D3tY3.png" alt="enter image description here"></p>
  
  <p>I think I can do that by accessing each pixel of the image and changing it as necessary, but I think that there might be a better way.</p>
  
  <p>I would like to do all this using CoreGraphics.</p>