title: Best way to scale size of camera picture before saving to SD
body: <p>The code below is executed as the jpeg picture callback after TakePicture is called. If I save data to disk, it is a 1280x960 jpeg. I've tried to change the picture size but that's not possible as no smaller size is supported. JPEG is the only available picture format. </p>
  
  <pre><code> PictureCallback jpegCallback = new PictureCallback() {
    public void onPictureTaken(byte[] data, Camera camera) {
     FileOutputStream out = null;
     Bitmap bm = BitmapFactory.decodeByteArray(data, 0, data.length); 
     Bitmap sbm = Bitmap.createScaledBitmap(bm, 640, 480, false);
  </code></pre>
  
  <p>data.Length is something like 500k as expected. After executing BitmapFactory.decodeByteArray(), bm has a height and width of -1 so it appears the operation is failing. </p>
  
  <ul>
  <li>It's unclear to me if Bitmap can handle jpeg data. I would think not but I have seem some code examples that seem to indicate it is.</li>
  <li>Does data need to be in bitmap format before decoding and scaling?</li>
  <li>If so, how to do this?</li>
  </ul>
  
  <p>Thanks!</p>