Ah ok. Surely i should be getting exif data written then, even without
the geo exif data? Could it be something to do with the way im saving
the image? I can't think of much else! Unless is the developer g1
phone im using to test this on?


                        Bitmap bm = BitmapFactory.decodeByteArray
(data, 0, data.length);
                        values.put
(MediaStore.Images.Media.DISPLAY_NAME, "Picture");
                        values.put
(MediaStore.Images.Media.DESCRIPTION, "taken with g1");
                        values.put(MediaStore.Images.Media.MIME_TYPE,
"image/jpeg");

                        Uri uri = getContentResolver().insert
(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

                        try {

                                OutputStream outStream =
getContentResolver().openOutputStream(uri);
                                bm.compress
(Bitmap.CompressFormat.JPEG, 85, outStream);
                                outStream.close();

                        } catch (Exception e) {
                                Log.e(TAG, "exception while writing
image", e);
                        }

Thanks,

George


On Feb 10, 5:49 pm, Dave Sparks <[email protected]> wrote:
> As far as I can tell, the only information we pass down through 
> theCamera.java layer to thecameradriver is geo-location. All the other
> EXIF data comes from the driver itself.
>
> ImageManager can be used to write additional EXIF data, but I believe
> that requires a full read/write sequence (whereas going through 
> thecameradriver, all the data is written along with the image).
>
> This is one of the areas I want to improve in the next release
> (Donuts).
>
> On Feb 10, 5:17 am, George <[email protected]> wrote:
>
> > I've tried reading the exif data with os x's 'more info' and EXIF
> > viewer for os x. They both show exif data for photos taken with the
> > nativecameraapp, but don't show anything for any of the photos i
> > take with my own app.
>
> > I was poking around the source code last night and noticed..
>
> > ImageManager.instance().addImage(..) - the source code of which seems
> > to be doing stuff with exif information. Should i be using the
> > ImageManager to save the images? I still can't for the life of me see
> > where the rest of the EXIF information comes from either!
>
> > Any ideas?
>
> > Cheers,
>
> > George
>
> > On Feb 10, 7:46 am, Dave Sparks <[email protected]> wrote:
>
> > > That looks reasonable to me. What are you using to read back the EXIF
> > > data?
>
> > > I was just working on the EXIF code over the weekend fixing a few bugs
> > > for the G1. I know that this code is working (the bugs I fixed were
> > > conversion errors, not missing data). I use exiftool to dump the EXIF
> > > tags.
>
> > > On Feb 9, 9:57 am, George <[email protected]> wrote:
>
> > > > I've been playing with the parameter code for most of today, can't
> > > > seem to get it to save any exif data. Even if i manually set lat /
> > > > long, it doesn't save anything. The parameter code you posted accounts
> > > > for the gps related exif information, but what of the rest? I can't
> > > > see where it's setting the rest of the data.
>
> > > > Here's the bit of code where i try to set the parameters. Should this
> > > > be else where?
>
> > > > Thanks,
>
> > > > George
>
> > > >                 if (keyCode == KeyEvent.KEYCODE_SPACE) {
>
> > > >                         android.hardware.Camera.Parameters parameters =
> > > > mCamera.getParameters();
>
> > > >                         parameters.set("jpeg-quality", 85);
>
> > > >                         parameters.remove("gps-latitude");
> > > >                         parameters.remove("gps-longitude");
> > > >                         parameters.remove("gps-altitude");
> > > >                         parameters.remove("gps-timestamp");
>
> > > >                         
> > > > parameters.set("gps-latitude","51.49473309516907");
> > > >                         parameters.set("gps-longitude", "-1.0");
> > > >                         parameters.set("gps-altitude", "71.0"); // 
> > > > meters
> > > >                         parameters.set("gps-timestamp", "1233744883");
>
> > > >                         mCamera.setParameters(parameters);
>
> > > >                         mCamera.takePicture(null, null, 
> > > > mPictureCallback);
>
> > > >                         return true;
> > > >                 }
>
> > > >                 return false;
> > > >         }
>
> > > > On Feb 6, 6:16 pm, Dave Sparks <[email protected]> wrote:
>
> > > > > Here's some code I grabbed from thecameraapp. In this case, the EXIF
> > > > > data is pre-encoded in the JPEG - no need to rewrite the file.
>
> > > > >         private void capture(boolean captureOnly) {
> > > > >             mPreviewing = false;
> > > > >             mCaptureOnlyBitmap = null;
>
> > > > >             final int latchedOrientation =
> > > > > ImageManager.roundOrientation(mLastOrientation + 90);
>
> > > > >             Boolean recordLocation = mPreferences.getBoolean
> > > > > ("pref_camera_recordlocation_key", false);
> > > > >             Location loc = recordLocation ? getCurrentLocation() :
> > > > > null;
> > > > >             android.hardware.Camera.Parameters parameters =
> > > > > mCameraDevice.getParameters();
> > > > >             // Quality 75 has visible artifacts, and quality 90 looks
> > > > > great but the files begin to
> > > > >             // get large. 85 is a good compromise between the two.
> > > > >             parameters.set("jpeg-quality", 85);
> > > > >             parameters.set("rotation", latchedOrientation);
>
> > > > >             parameters.remove("gps-latitude");
> > > > >             parameters.remove("gps-longitude");
> > > > >             parameters.remove("gps-altitude");
> > > > >             parameters.remove("gps-timestamp");
>
> > > > >             if (DEBUG_FAKE_GPS_LOCATION) {
> > > > >                 // Google London office, having trouble encoding
> > > > > longitude
>
> > > > >                 if (false) {
> > > > >                     // This fails:
> > > > >                     parameters.set("gps-latitude",
> > > > > "51.49473309516907");
> > > > >                     parameters.set("gps-longitude",
> > > > > "-0.14598190784454346");
> > > > >                     parameters.set("gps-altitude", "71.0"); // meters
> > > > >                     parameters.set("gps-timestamp", "1233744883");
> > > > >                 } else {
> > > > >                     // This works OK:
> > > > >                     parameters.set("gps-latitude",
> > > > > "51.49473309516907");
> > > > >                     parameters.set("gps-longitude", "-1.0");
> > > > >                     parameters.set("gps-altitude", "71.0"); // meters
> > > > >                     parameters.set("gps-timestamp", "1233744883");
> > > > >                 }
> > > > >             } else if (loc != null) {
> > > > >                 double lat = loc.getLatitude();
> > > > >                 double lon = loc.getLongitude();
> > > > >                 boolean hasLatLon = (lat != 0.0d) || (lon != 0.0d);
>
> > > > >                 if (hasLatLon) {
> > > > >                     String latString = String.valueOf(lat);
> > > > >                     String lonString = String.valueOf(lon);
> > > > >                     parameters.set("gps-latitude",  latString);
> > > > >                     parameters.set("gps-longitude", lonString);
> > > > >                     if (loc.hasAltitude())
> > > > >                         parameters.set("gps-altitude",  String.valueOf
> > > > > (loc.getAltitude()));
> > > > >                     if (loc.getTime() != 0) {
> > > > >                         // Location.getTime() is UTC in milliseconds.
> > > > >                         // gps-timestamp is UTC in seconds.
> > > > >                         long utcTimeSeconds = loc.getTime() / 1000;
> > > > >                         parameters.set("gps-timestamp", String.valueOf
> > > > > (utcTimeSeconds));
> > > > >                     }
> > > > >                 } else {
> > > > >                     loc = null;
> > > > >                 }
> > > > >             }
>
> > > > >             Size pictureSize = parameters.getPictureSize();
>
> > > > >             // resize the SurfaceView to the aspect-ratio of the still
> > > > > image
> > > > >             // and so that we can see the full image that was taken
> > > > >             mSurfaceView.setAspectRatio(pictureSize.width,
> > > > > pictureSize.height);
>
> > > > >             mCameraDevice.setParameters(parameters);
>
> > > > >             mCameraDevice.takePicture(mShutterCallback,
> > > > > mRawPictureCallback, new JpegPictureCallback(loc));
>
> > > > >             mBlackout.setVisibility(View.VISIBLE);
> > > > >             // Comment this out for now until we can decode the
> > > > > preview frame. This currently
> > > > >             // just animates black-on-black because the surface
> > > > > flinger blacks out the surface
> > > > >             // when thecameradriver detaches the buffers.
> > > > >             if (false) {
> > > > >                 Animation a = new
> > > > > android.view.animation.TranslateAnimation(mBlackout.getWidth(), 0 , 0,
> > > > > 0);
> > > > >                 a.setDuration(450);
> > > > >                 a.startNow();
> > > > >                 mBlackout.setAnimation(a);
> > > > >             }
> > > > >         }
>
> > > > > On Feb 6, 9:00 am, George <[email protected]> wrote:
>
> > > > > > I've found the ExifInterface class in thecamerasource code which
> > > > > > takes a file name as a string. I cant figure how to get the file 
> > > > > > name
> > > > > > of the image i've just taken? I dont really want to have to save the
> > > > > > image to reload it again, anyway of pointing to the 'bm' jpeg 
> > > > > > picture
> > > > > > object?
>
> > > > > > Thanks again,
>
> > > > > > George
>
> > > > > > public void onPictureTaken(byte[] data,Camerac) {
>
> > > > > >                         Bitmap bm = 
> > > > > > BitmapFactory.decodeByteArray(data, 0, data.length);
>
> > > > > >                         // Save the name and description in a map. 
> > > > > > Key is the content
> > > > > >                         // provider's
> > > > > >                         // column name, value is the value to save 
> > > > > > in that record field.
> > > > > >                         ContentValues values = new ContentValues(3);
> > > > > >                         // set name to date + time
> > > > > >                         // description - current goal?
> > > > > >                         
> > > > > > values.put(MediaStore.Images.Media.DISPLAY_NAME, "Picture");
> > > > > >                         
> > > > > > values.put(MediaStore.Images.Media.DESCRIPTION, "taken with g1");
> > > > > >                         
> > > > > > values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
> > > > > >                         
> > > > > > //values.put(MediaStore.Images.ImageColumns.DESCRIPTION, "THIS IS
> > > > > > EXIF DATA" );
> > > > > >                         
> > > > > > //values.put(MediaStore.Images.ImageColumns., "THIS IS EXIF
> > > > > > DATA" );
>
> > > > > >                         
> > > > > > //values.put(MediaStore.Images.ImageColumns.LATITUDE, value);
> > > > > >                     
> > > > > > //values.put(MediaStore.Images.ImageColumns.LONGITUDE, value);
>
> > ...
>
> > read more »
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to