title: How to compress photo in Android with Kotlin
body: <p>now this is my code to take a photo from my smartphone, the problem is that the image is very large and I would like to compress it, some help or idea?</p>
  
  <p>thanks for the info</p>
  
  <p>Execution of the method abrirCamara()</p>
  
  <pre><code>private fun abrirCamara() {
      val values = ContentValues()
      values.put(MediaStore.Images.Media.TITLE, "Nueva foto")
      values.put(MediaStore.Images.Media.DESCRIPTION, "Desde la camara")
      image_uri = contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values)
      //intención de la cámara
      val cameraIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
      cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, image_uri)
      startActivityForResult(cameraIntent, IMAGE_CAPTURE_CODE)
  
  }
  </code></pre>
  
  <p>is called when the user press PERMIT or DENY from the permission request pop-up window</p>
  
  <pre><code>override fun onRequestPermissionsResult(requestCode: Int, permissions: Array&lt;out String&gt;, grantResults: IntArray) {
  
      when(requestCode){
          PERMISSION_CODE -&gt; {
              if (grantResults.size &gt; 0 &amp;&amp; grantResults[0] ==
                  PackageManager.PERMISSION_GRANTED){
                  //permiso de popup fue concedido
                  abrirCamara()
              }
              else{
                  //el permiso de popup fue denegado
                  Toast.makeText(this, "Permiso denegado", Toast.LENGTH_SHORT).show()
              }
          }
      }
  }
  </code></pre>
  
  <p>Call when the image was captured from the camera's intention</p>
  
  <pre><code>     override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
      //Llamada cuando la imagen fue capturada desde la intención de la cámara
      if (resultCode == Activity.RESULT_OK){
  
  
          //configurar imagen capturada a vista de imagen (ImageView)
          imgEnvio.setImageURI(image_uri)        
  
          captura_btn.visibility =View.INVISIBLE
          siguiente.visibility=View.VISIBLE
  
      }
  }
  </code></pre>