title: String to Bitmap in Kotlin
body: <p>I'm new to Kotlin and I can't seem to work this one out. I get a base64String and I need an image.</p>
  
  <p>I did:</p>
  
  <pre><code>val imageBytes = string.toByteArray(). // string is the base64image
  val image = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size)
  </code></pre>
  
  <p>Problem is that when I try to access the <code>image</code> , I get a <code>SkAndroidCodec::NewFromStream returned null</code> message in the log. I wanted to use it inside a method with a return but it kept crashing on <code>return image</code>.</p>
  
  <p><strong>How do I convert it correctly?</strong></p>
  
  <p>I have checked and string is not empty, imageBytes has content and imageBytes.size is over 60000. The same string I use in swift and it converts image without any modifications, so I am confident the string is not the problem.</p>