title: UIImage to Base64 string problem. Space under image when decoded
body: <p>I converted an <code>UIImage</code> to Base64 string. When other service decode it to <code>UIImage</code> a huge space just below the image can be seen.</p>
  
  <p><strong>I use this method to convert from <code>UIImage</code> to Base64:</strong></p>
  
  <pre><code>func convertImageToBase64(image: UIImage) -&gt; String {        
      let jpegCompressionQuality: CGFloat = 0.5
      let imageData = UIImageJPEGRepresentation(image, jpegCompressionQuality)
      let base64String = imageData?.base64EncodedString()
  
      return base64String!
  }
  </code></pre>
  
  <p>Decoding on simulator - view background color is black:</p>
  
  <p><strong>see the image here</strong></p>
  
  <p><img src="https://i.stack.imgur.com/rZuLa.png" alt="Screen Shot"></p>
  
  <p>The white space below the image can be seen in this decode example when the background of the view is black.</p>
  
  <p>Can anyone give me a hint to avoid it?</p>