title: Rotate byte array of JPEG after onPictureTaken
body: <p>Is there a way to rotate byte array without decoding it to Bitmap?</p>
  
  <p>Currently in jpeg PictureCallback I just write byte array directly to file. But pictures are rotated. I would like to rotate them without decoding to bitmap with hope that this will conserve my memory.</p>
  
  <pre><code>    BitmapFactory.Options o = new BitmapFactory.Options();
      o.inJustDecodeBounds = true;
      BitmapFactory.decodeByteArray(data, 0, data.length, o);
  
      int orientation;
      if (o.outHeight &lt; o.outWidth) {
          orientation = 90;
      } else {
          orientation = 0;
      }
  
      File photo = new File(tmp, "demo.jpeg");
  
      FileOutputStream fos;
      BufferedOutputStream bos = null;
      try {
          fos = new FileOutputStream(photo);
          bos = new BufferedOutputStream(fos);
          bos.write(data);
          bos.flush();
      } catch (IOException e) {
          Log.e(TAG, "Failed to save photo", e);
      } finally {
          IOUtils.closeQuietly(bos);
      }
  </code></pre>