static void writeBitmapToUri(
      Context context,
      Bitmap bitmap,
      Uri uri,
      Bitmap.CompressFormat compressFormat,
      int compressQuality)
      throws FileNotFoundException {
    OutputStream outputStream = null;
    try {
      outputStream = context.getContentResolver().openOutputStream(uri);
      bitmap.compress(compressFormat, compressQuality, outputStream);
    } finally {
      closeSafe(outputStream);
    }
  }
Write the given bitmap to the given uri using the given compression.
core/src/main/java/com/theartofdev/edmodo/cropper/BitmapUtils.java