Image Copying, Exif Data Loss

I copy the image to a private directory, for example:

FileChannel source = null;
FileChannel destination = null;
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(destFile).getChannel();
destination.transferFrom(source, 0, source.size());
source.close();
destination.close();

.. but when I return it back to the Gallery untouched at a later time:

private void moveImageToGallery(Uri inUri) throws Exception {
    MediaStore.Images.Media.insertImage(getContentResolver(), ImageUtil.loadFullBitmap(inUri.getPath()), null, null);
}

.. he seems to be losing his Exif data. Spinning no longer works. Is there a way to copy the image file and not lose this data? Thanks for any suggestions.

+5
source share
1 answer

FileChannel, , , , , , ; EXIF. () . , / , - (: Android Linux, Linux UNIX = > rwx (. chmod)), . , FileChannel - .

:

InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(dest);
byte[] buf = new byte[1024]; int len;
while ((len = in.read(buf)) > 0)
    out.write(buf, 0, len);
in.close();
out.close();
+2

All Articles