Try using the following code to save the PNG image
try {
FileOutputStream out = new FileOutputStream(filename);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
} catch (Exception e) {
e.printStackTrace();
}
out.flush();
out.close();
Here 100 is the quality to keep in compression. You can pass anything between 0 and 100. Lower the number, low quality with reduced size.
Note
Android.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Edit
.BMP, Android Bitmap Util . .
String sdcardBmpPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/sample_text.bmp";
Bitmap testBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.sample_text);
AndroidBmpUtil bmpUtil = new AndroidBmpUtil();
boolean isSaveResult = bmpUtil.save(testBitmap, sdcardBmpPath);