title: How to Reduce the base64 String Length
body: <p>I am trying to convert the Image selected from the <code>UIImagePickerController</code> into <code>base64</code> String. But the length of the String is about more than <code>12 Corer</code>it's making iPhone hang. </p>
  
  <p>This is the code that I using.  </p>
  
  <pre><code> func compressImage(img:UIImage) -&gt; String {
      Utill.showProgress()
      var imageData =  Data(UIImagePNGRepresentation(img)! )
      print("***** Uncompressed Size \(imageData.description) **** ")
      imageData = UIImageJPEGRepresentation(img, 0.025)!
      print("***** Compressed Size \(imageData.description) **** ")
      let image = UIImage(data: imageData)
      let imagesData:NSData = UIImagePNGRepresentation(image!)! as NSData
      let strBase64 = imagesData.base64EncodedString(options: .lineLength64Characters)
      Utill.dismissProgress()
      return strBase64
  
  }
  </code></pre>
  
  <p>Is there any other way to reduce the String, to be around 10K - 30K?</p>