

Now with features such as a beautiful modern interface, photo editing right within the app, and organization like no other, it’s easy to see why so many Apple users love and use Photos. While ((r=fin.read(buf,0,buf.The Photos app on Mac has come a long way since it was iPhoto back in the day. The copyFile is shown here: public static boolean copyFile(String in, String out, boolean deleteOriginal)įileInputStream fin = new FileInputStream(in) įileOutputStream fout = new FileOutputStream(out)


The bug and handleException are used to dump the Log and print the exception. Int id = imageCursor.getInt(imageCursor.getColumnIndex(._ID)) Ĭase ExifInterface.ORIENTATION_ROTATE_90: angle = 90 break Ĭase ExifInterface.ORIENTATION_ROTATE_180: angle = 180 break Ĭase ExifInterface.ORIENTATION_ROTATE_270: angle = 270 break īitmapFactory.Options options = new BitmapFactory.Options() īitmap bmp = codeStream(new FileInputStream(f), null, options) īitmap bitmap = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), mat, true) įileOutputStream out = new FileOutputStream(f) īpress(, 85, out) Ībug("auto-rotated "+imagePath) Long last = imageCursor.getLong(imageCursor.getColumnIndexOrThrow(_ADDED)) StartActivityForResult(intent, EXTCAMERA_RETURN) Īnd this is the one to grab the taken photo: String projection = įinal String imageOrderBy = ._ID+" DESC" Ĭursor imageCursor = managedQuery(_CONTENT_URI, imageColumns, null, null, imageOrderBy) Intent.putExtra(MediaStore.EXTRA_OUTPUT, capturedImageURI) Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE) Values.put (_PRIVATE, 1) ĬapturedImageURI = getContentResolver().insert(_CONTENT_URI, values) Private String imageFN // stored globally but could be a parameterĬontentValues values = new ContentValues() This is the code used to take the photo: private static final int EXTCAMERA_RETURN = 1234324334 I delete it if difference is less than one second (its usually less than 10ms). Then, you get the last image added to the gallery, and compare with the added date of the original image. The fix uses code that i found in some questions here in StackOverflow, and also an improvement of my own.įirst, you get the image with the URI you used to create the intent, get its added date, and delete it.
