Android - Reading EXIF ​​information from file using ExifReader is very slow

I have an image processing application that needs to remember which photos have already been processed. The solution I came across was to store the given string ("abc-") into the EXIF ​​MAKE tag. So, in order to filter the photos, my application needs to read the EXIF ​​MAKE attribute to see if it contains my string ("abc-"). I tested it with the following code and it took about 15 seconds to execute on another phone with Android 5.1.1 CyanogenMod and 1000 photos, which is a very bad 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-");
}

      

Another solution I was thinking about was to store the processed image filenames in a SQLite database. This will be a faster option, but the problem is that if a user copies their photos to a new device, my app won't remember which photos have already been processed, so I will need to back up my database to the cloud and restore it to a new one. device.

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

thank

+3


source to share





All Articles