title: How to create base64 profile image form user name or user email?
body: <p>I have User object Like following</p>
  
  <pre><code>{
    "id": "25",
    "name": "Mehul Rami",
    "email": "mehul@demo.com"
  }
  </code></pre>
  
  <p>user name contain both first and last name.</p>
  
  <p>I want to generate profile image form user object. like following:</p>
  
  <p><a href="https://i.stack.imgur.com/wOi6J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wOi6J.png" alt="enter image description here"></a></p>
  
  <ol>
  <li>Pick up any random color for background</li>
  <li>if name present then The first letters from the users first name and the first letter of the users last name. i.e. Mehul Rami would be MR. if name not present then The first char from the email and the first char after the @ in the email. i.e. mehul@demo.com would be MD.</li>
  </ol>
  
  <p>Once, image is generate I want to convert it in <code>base64</code> string.</p>