-1

When I save the image on sdcard then Image quality is lost

Here is my code for the same

Bitmap bitmap2 = extras.getParcelable("data");
File file = new File(path);
FileOutputStream fOut = new FileOutputStream(file);
bitmap2.compress(Bitmap.CompressFormat.JPEG, 100, fOut);
fOut.flush();
fOut.close();
Jaspreet Chhabra
  • 1,431
  • 15
  • 23

1 Answers1

1

If you don't want to lose quality, save your file as PNG which is a lossless compression format:

bitmap2.compress(Bitmap.CompressFormat.PNG, 100, fOut);
Szymon
  • 42,577
  • 16
  • 96
  • 114