Android - Reading EXIF information from file using ExifReader very slow

769 views Asked by At

I have an image processing app which needs to remember which photos were already processed. The solution I came up with was to store a given String ("abc-"), into the EXIF MAKE tag. So, in order to filter the photos, my app needs to read the EXIF MAKE attribute to see if it contains my String ("abc-"). I have tested it with the following code and its execution took around 15 seconds on a friend's phone with Android 5.1.1 CyanogenMod and 1000 photos, which is a very poor time.

public boolean isAlreadyProcessed(File imageFile) {
    android.media.ExifInterface exifInterface = new ExifInterface(imageFile.getAbsolutePath());
    String attribute = exifInterface.getAttribute(ExifInterface.TAG_MAKE);

    return attribute.contains("abc-");
}

Other solution I thought about was to store the processed images filenames into a SQLite database. This would be a faster option, but it has the problem that if a user copys his photos to a new device, my app wouldn't remember which photos were already processed, so I would need to backup my database to the cloud and restore it on the new device.

So, is there a more efficient way to read EXIF image metadata? If not, is there a better way to accomplish this than the second way I mentioned (to store the images names in a database)?

Thank you

0

There are 0 answers