After taking a picture with the camera intent, I compress the bitmap to lower the file size. The problem is that after compression, it loses all EXIF data. I have no problem retrieving the original EXIF data, however, how do I add this EXIFF data after compression into the byte array ?
(My guess is to take the byte array and create a bitmap of that, then add the old EXIF data and thereafter add to byte array again, but this is a mobile application and I'm taking a lot of images so I don't want to waste memory)
Here is the code where I compress the bitmap and save to byte array output stream:
myBitmapImage.compress(Bitmap.CompressFormat.JPEG, 75, outputstream);//Losing EXIF data here
byte[] ba = outputstream.toByteArray(); // How to add EXIF data here ?