I have an Image File (jpg) and i need to rotate it. However, i would like to avoid to re compress it when saving it back to the disk. Is their any way to do this?
I save the image like this:
matrix.setRotate(-90);
Bitmap bitmap = BitmapFactory.decodeFile(imagePath, options);
Bitmap bmRotated = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
bitmap.recycle();
FileOutputStream fileoutputstream = new FileOutputStream(imagePath);
bmRotated.compress(CompressFormat.JPEG, 100, fileoutputstream);
fileoutputstream.flush();
fileoutputstream.close();
bmRotated.recycle();