title: Php and Canvas pixel color replacement
body: <p>Hello dear people of internet,</p>
  
  <p>I have an idea for interesting script, but I'm trying to find the best way to accomplish what I want.</p>
  
  <p>Idea is simple. Have pixels colors replaced, to achieve custom color for character every time. I have this guy, I will be using php canvas and maybe svg to generate these images:
  source image</p>
  
  <p><a href="https://i.stack.imgur.com/2z3Y2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2z3Y2.jpg" alt="enter image description here"></a></p>
  
  <p>And what I basically need is via script turn it into this: final result</p>
  
  <p><a href="https://i.stack.imgur.com/zxOFW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zxOFW.jpg" alt="enter image description here"></a></p>
  
  <p>I considered few ways to do it:</p>
  
  <p>1) Have alpha only pixels and color it from behind and place alpha image on top to achieve shading and depth</p>
  
  <p>2) Draw each pixel individually (but this option isn't what I really want to do)</p>
  
  <p>3) Use some thing like hue/saturation, but that is beyond my knowledge.</p>
  
  <p>maybe there is something I can do to achieve it.</p>
  
  <p>Thank you.</p>