Hi all,
I am trying to get the Exif information into my JPEG picture. I have
searched this forum but I havent found a post that solves this problem
and there doesnt seem to be a lot of information about it.
I am saving the image in the JpegPictureCallback on onPictureTaken
after instantiating the camera. My filesaving code from my app:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
OutputStream outStream = getContext().getContentResolver
().openOutputStream(uri);
Bitmap sourceBitmap = BitmapFactory.decodeByteArray(jpegData,0,
jpegData.length, options);
sourceBitmap.compress(Bitmap.CompressFormat.JPEG, 50, outStream);
outStream.close();
However this does not write any exif information into the image it
seems and I am not sure if it is possible or any options for doing it
there? I add some metatags into the ContentValues but that doesnt seem
to help either.
values.put(Images.Media.LATITUDE, location.getLatitude());
Uri uri = getContext().getContentResolver().insert(
Media.EXTERNAL_CONTENT_URI, values);
So I am trying to use the ExifInterface from the Camera.app to write
the info into the jpeg file after I ported the ExifInterface to my app
from the Camera.app
HashMap<String, String> mExifData = new HashMap<String, String>();
mExifData.put("GPSLatitude","22");
mExifData.put("GPSLongitude","22");
mExifData.put("Orientation","1");
mExifData.put("DateTimeOriginal","22");
mExifData.put("Make","Android Make");
mExifData.put("Flash","Android Model");
mExifData.put("Flash","no");
mExifData.put("ImageWidth","60");
mExifData.put("ImageLength","60");
mExifData.put("GPSLatitudeRef","60");
mExifData.put("GPSLongitudeRef","60");
ExifInterface exif = new ExifInterface(fname);
exif.saveAttributes(mExifData);
exif.commitChanges();
However that chokes on the commitChanges call that gives me an error :
"ERROR/(11321): Can't write back - didn't read all". It seems the
flagg "HaveAll" in jpgfile.c is not ready or set correctly. I am
wondering if anybody knows how to get the exif info into the jpeg when
storing it the first time or how to solve the write problem using the
ExifInterface. Any help would be greatly appreciated.
This is an app using the 1.1 sdk.
regards,
gard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---