When I store captured image from camera after cropping, cropped jpg image file is
stored in my specified folder.
I want to store "that" cropped image file with bmp filename extension.
When I store captured image from camera after cropping, cropped jpg image file is
stored in my specified folder.
I want to store "that" cropped image file with bmp filename extension.
I suggest the steps are:
After cropped jpg you convert it to Bitmap with this code
Bitmap bMap = BitmapFactory.decodeFile(imgPath);
Save bMap with bmp extention you can follow suggest function over HERE
Delete cropped jpg file to free memory
File dir = getFilesDir();
File file = new File(dir, "filename");
if (file.exists()) {
boolean deleted = file.delete();
}
Try below code -
FileOutputStream out = null;
try {
out = new FileOutputStream(AbsoluteFilePath);
bmp.compress(Bitmap.CompressFormat.PNG, 100, out); // bmp is your Bitmap instance
// PNG is a lossless format, the compression factor (100) is ignored
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
SOURCE : Save bitmap to location