title: Android: How can I save image files that are not (JPEG & PNG)? [after rotate]
body: <p>I am trying to rotate an image from sdcard and then save back to sdcard.</p>
  
  <p>I can do that for ".jpg" format by using ExifInterface class:</p>
  
  <pre><code>exif = new ExifInterface(filepath);
  exif.setAttribute(ExifInterface.TAG_ORIENTATION, Integer.toString(orientation));
  exif.saveAttributes();
  </code></pre>
  
  <p>For ".png" files, I would have to actually rotate and save:</p>
  
  <pre><code>Bitmap bitmap = BitmapFactory.decodeFile(filepath);
  Matrix matrix = new Matrix();
  matrix.postRotate(degrees);
  bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
  FileOutputStream stream = new FileOutputStream(fileLocation);
  bitmap.compress(CompressFormat.PNG, 100, stream);
  </code></pre>
  
  <p>What about ".bmp", ".tiff", ".gif" ??</p>
  
  <p>It seems like CompressFormat only supports 'CompressFormat.PNG' and 'CompressFormat.JPG'.</p>
  
  <p>Is this limitation?</p>