tags:

views:

589

answers:

3

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

A: 

It appears from posts like this that the camera class does not support EXIF data, and the camera application uses it's own EXIF implementation.

One option would be to browse the source that is mentioned in that thread and see if there is anything that you can use.

Another option would be the sanselandandroid project. The developer admits that it is not a perfect port, but he developer is a somewhat active participant in the android centric Google groups and sells his own camera software Snap FX which includes an application named Camera FX that saves EXIF data according to the product page.

Good luck.

Pictures are saved with EXIF tags that are compatiable with most software editing applications.

snctln
+2  A: 

Thanks scntln!

I'm using this indeed in my Camera FX app. It works well for embedding EXIT 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 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 :)

Streets Of Boston
+1  A: 

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);
Travis