title: Save a bitmap to file
body: <p>I want to open one image from my assets folder, resize it and resave the image. I use this code:</p>
  
  <pre><code>private void resizeImage(float ratio) {
      AssetManager assetManager = getAssets();
      InputStream stream = null;
      try {
          stream = assetManager.open("bear.png");
      } catch (IOException e) {
          return;
      }
      Bitmap bitmapOrg = BitmapFactory.decodeStream(stream);
  
      int width = bitmapOrg.getWidth();
      int height = bitmapOrg.getHeight();
  
      float scaleWidth = ((float) width) / ratio;
      float scaleHeight = ((float) height) / ratio;
  
      Matrix aMatrix = new Matrix();
      aMatrix.setSkew(scaleWidth, scaleHeight);
  
      bitmapOrg = Bitmap.createBitmap(bitmapOrg, 0, 0, bitmapOrg.getWidth(),
              bitmapOrg.getHeight(), aMatrix, false);
  
  }
  </code></pre>
  
  <p>But when I start application it crash. This is stack trace:</p>
  
  <pre><code>12-09 02:36:33.750: ERROR/AndroidRuntime(1939):     at android.graphics.Bitmap.nativeCreate(Native Method)
  12-09 02:36:33.750: ERROR/AndroidRuntime(1939):     at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
  12-09 02:36:33.750: ERROR/AndroidRuntime(1939):     at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
  </code></pre>
  
  <p>Does someone know why crash?</p>