title: Save Bitmap image to SD card - problem in API 1.5?
body: <p>Any idea why this is not working on a HTC Hero running on Android API 1.5 ?</p>
  <pre><code>    private static void Save_to_SD (Bitmap bm, String image_name){
    
    String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
    String meteoDirectory_path = extStorageDirectory + &quot;/Weather_Belgium&quot;;
      
    OutputStream outStream = null;
    File file = new File(meteoDirectory_path, &quot;/&quot;+ image_name);
    try {
     outStream = new FileOutputStream(file);
     bm.compress(Bitmap.CompressFormat.PNG, 100, outStream);
     outStream.flush();
     outStream.close();
  
     Log.i(&quot;Hub&quot;, &quot;OK, Image Saved to SD&quot;);
     Log.i(&quot;Hub&quot;, &quot;height = &quot;+ bm.getHeight() + &quot;, width = &quot; + bm.getWidth());
  
    } catch (FileNotFoundException e) {
  
     e.printStackTrace();
     Log.i(&quot;Hub&quot;, &quot;FileNotFoundException: &quot;+ e.toString());
  
    } catch (IOException e) {
  
     e.printStackTrace();
     Log.i(&quot;Hub&quot;, &quot;IOException: &quot;+ e.toString());
    }
     
   }
  </code></pre>
  <p>Logcat doesn't show any error and my images are normally 340x380:</p>
  <blockquote>
  <p>12-19 12:06:41.035: INFO/Hub(1762): directory exists</p>
  <p>12-19 12:06:41.035: INFO/Hub(1762): isDirectory = true</p>
  <p>12-19 12:06:41.045: INFO/Hub(1762): OK, Image Saved to SD</p>
  <p>12-19 12:06:41.045: INFO/Hub(1762): height = 340, width = 380</p>
  <p>12-19 12:06:41.055: INFO/Hub(1762): OK, Image Saved to SD</p>
  </blockquote>
  <p>When I then browse my SD card and take a look at my saved images, these are saved as &quot;Invalid Image&quot; 48 octets images !?</p>
  <p>What's happening ?</p>
  <p>Manifest:</p>
  <pre><code>&lt;uses-sdk android:minSdkVersion=&quot;3&quot; 
                android:targetSdkVersion=&quot;4&quot; /&gt;
  
    
  &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
  &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
  &lt;uses-permission android:name=&quot;android.permission.VIBRATE&quot; /&gt;
  &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
  </code></pre>
  <p>EDIT :
  it looks like this code is working properly for PNG, JPG images but the problem has to do with the fact that my images are GIF images initially (downloaded from the web).</p>