I'm using the android.hardware.Camera
class to take pictures and i'm finding that no exif data is stored in the images at all. If i use the camera application on my DROID all of the exif data is being saved.
I've tried setting the rotation with Set() and SetRotation() to see if I can get some exif data to show up. When I view the images on my laptop with an exif reader it tells me the image has NO exif data.
I've seen some similar posts, but I have not found a solution to this. Has anyone seen this issue with other phones?
I'm using the Android 2.0.1 SDK
So after some more research I found that I was loosing the EXIF information when i used the following code to save the image data to the SD card.
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 0;
Bitmap myImage = BitmapFactory.decodeByteArray(imageData, 0, imageData.length);
FullFileName = sdImageMainDirectory.toString() + "/DCIM/Camera/" + getDateTime() + ".jpg";
fileOutputStream = new FileOutputStream(FullFileName);
BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream);
myImage.compress(CompressFormat.JPEG, quality, bos);
bos.flush();
bos.close();
I changed the above code to simply be this, and now all the EXIF data from the camera is present.
FileOutputStream file = new FileOutputStream(FileName);
file.write(imageData);
Thanks scntln!
I'm using this indeed in my Camera FX app. It works well for embedding EXIF tags in JPEGS (not in PNG files).
Android SDK version 2.x has its own ExifInterface class that you could use instead. But if you need to support 1.6 or lower, then my sanselandroid port should work fine.
I'm still in the process of pruning the sanselanandroid project more to contain only what's absolutely necessary for just writing EXIF tags.
BTW: I noticed here that I spelled 'compatiable' incorrectly. Fixed that on my blog :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With