Giter Site home page Giter Site logo

renuacpro / exif-thumbnail-adder Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 1.0 53.28 MB

Android app to add thumbnail in the EXIF tag of JPEG pictures not having one (batch processing)

License: GNU General Public License v3.0

Ruby 0.01% Java 2.19% HTML 0.19% CMake 0.24% C 78.94% Makefile 1.32% Shell 2.14% M4 0.51% Roff 0.08% sed 0.01% C++ 8.48% Python 0.07% CSS 0.01% JavaScript 0.02% Batchfile 0.01% Inno Setup 0.01% Perl 0.04% Assembly 5.74% Coq 0.01% CodeQL 0.01%

exif-thumbnail-adder's Introduction

Exif Thumbnail Adder

This application for android devices searches for pictures (JPEG) on your device and adds a thumbnail if they don't have one yet. Thumbnails are added to the EXIF metadata structure.

It is designed to work from android Oreo (android 8, SDK 26).

Please report issues here: https://github.com/tenzap/exif-thumbnail-adder/issues.

For more information, some known facts and how you may contribute, refer to the project homepage.

Rationale

On some smartphones, when wanting to import pictures to Windows (or any device/operating system supporting MTP or PTP protocols), I noticed the pictures may not display a thumbnail in the import wizard (whether through the Photos app, or through the Windows Explorer import feature).

There are two possible reasons for that behaviour. First, the thumbnail is not present in the picture, usually because the app that created the picture didn't add a thumbnail. Second, there is a thumbnail but it is ignored because some EXIF tags are missing.

Features

  • Add thumbnail to pictures (JPEG) that don't yet have one
  • Lanczos algorithm to downsample picture thanks to FFmpeg's swscale library for best results.
  • Select one or more folders to scan from any storage (internal, SDCard...). For example DCIM, Pictures...
  • Exclude one subdirectory from selected directories
  • Preserve timestamps of the pictures
  • Processing log
  • Synchronize deleted files in the source directory to the backup and working directory (so that you don't keep in the backup folder pictures you don't have anymore in the source folder)
  • Conservative default options (backup pictures, skip corrupt files)
  • Install app on internal storage or external storage
  • Default EXIF library: Exiv2.
  • Alternative libraries: Android-Exif-Extended, libexif, pixymeta-android. See known facts on project page to learn more on benefits and drawbacks of each library.
  • Settings:
    • Rotate the thumbnail
    • Replace existing thumbnail
    • Backup of original pictures (backup is never overwritten by the app once created if you choose to add the thumbnail to the input file in its initial location)
    • Skip pictures having malformed metadata (this can be disabled to process also files having corrupt tags)
    • Replace picture in place or write new picture to another directory

Requested permissions

  • READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE
    • to keep the timestamp of the pictures
  • MANAGE_EXTERNAL_STORAGE
    • requested only with the standard flavor that is shipped on F-Droid for devices running Android 11 and above to keep the timestamp of the pictures
  • get more details about them on the project homepage

Installation

  • Prerequisites: minimum android Oreo (android 8, SDK 26). App was tested up to Android 11.
  • Download it through F-Droid app here
  • Download the APK from the release page

License

GPL-3.0 (see "COPYING" file on project homepage)

Contribute

Known facts

  • Performance may be slower on SDCards, that may be related to the speed of your SDCard.

Android-Exif-Extended

  • all the existing EXIF structure is kept and a new APP1 structure containing the thumbnail is added to the existing APP1.
  • this means that all EXIF tags will be duplicate if checked by exiftool
  • Any other tags (XMP for example) are kept

Exiv2

  • [XMP*] is kept
  • If Exiv2 detects some problems (errors) in a file, it is skipped (reported error is displayed in the app). This setting can be changed in the app configuration.

libexif

  • All [XMP*] metadata groups and tags get deleted.
  • Some or all tags of [Olympus] [Canon] group might be deleted.
  • The tags supported by libexif and exif structure are rewritten from what libexif could read.
  • It is almost like running "exif --create-exif --remove-thumbnail --insert-thumbnail tb.jpg" from the exif command line.
  • If libexif detects some problems (errors) in a file, it is skipped (reported error is displayed in the app). This setting can be changed in the app configuration.

pixymeta-android

  • usage is discouraged until pixymeta bug is fixed
  • the existing EXIF tags are read and metadata is rewritten from scratch using what was read
  • [XMP*] tags are kept
  • [InteropIFD] directory is not correctly rewritten leading to problems such as "Bad InteropIFD directory" or "IFD1 pointer references previous InteropIFD directory" or "GPS pointer references previous InteropIFD directory". See pixymeta bug report. This issue may lead to problems and even crashes when the app or another reads the output picture because the EXIF metadata gets malformed.

Concerning READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE

  • permit to read and write/update the picture from the storage of your device
  • requested with the google_play flavor that is shipped on google play and with the standard flavor on Android 10 and before
  • these permissions are required to keep the timestamp of the pictures

Concerning MANAGE_EXTERNAL_STORAGE (for flavor standard)

Since flavor standard uses targetSdk >= 30 (ie Android 11+), I needed to use the MANAGE_EXTERNAL_STORAGE permission. This might be problematic to publish on the play store. See 1 2.

Some explanations:

The app uses the Storage Access Framework to process the files. However, with Storage Access Framework, on copying files or modifying them, timestamps get updated. But when adding thumbnails we don't want them to change and thus I set them back to the original value. To set the values of timestamps back I use the BasicFileAttributesView class 3. This works fine until targetSdk 28 (=android 9). There is a workaround for targetSdk 29 (android 10) but from targetSdk 30 (Android 11) onwards, the method returns an "AccessDeniedException". So I ended up using MANAGE_EXTERNAL_STORAGE with targetSdk >= 30, see 4.

So in the App, when one is on Android 11+ with targetSdk >= 30 (which is the case of flavor standard), one is invited to give the "all files access" permissions through the settings. This is not mandatory. In case permission is not given, the user is informed that timestamps can't be kept during processing.

With flavor google_play targetSdk is set to 29. Hence it is still possible with Android 11 to not use MANAGE_EXTERNAL_STORAGE. For versions above 11 it is uncertain whether it will still work. To be sure to have all functionalities of the app if you run Android 11+ get the standard flavor from F-Droid.org

Please note that this is about the timestamps of the files (not the ones in the EXIF tags)

Development / Building from source

This project has been developed in "Android Studio", you may use that to build the app yourself.

In addition to Android Studio you need these components (android studio can install them for you thanks to the SDK Manager):

  • SDK
  • NDK
  • CMake

Flavors

The app can be compiled in any of the following flavors:

  • standard (version shipped on F-Droid)
  • google_play (version for Google Play). It is the same as "standard" except it has targetSdk 29 and doesn't request MANAGE_EXTERNAL_STORAGE permission.

To create screenshots

From within the root directory of the project run:

ANDROID_SDK_ROOT=~/Android/Sdk/ bundle exec fastlane screenshots

exif-thumbnail-adder's People

Contributors

tenzap avatar poussinou avatar

Forkers

tun-0-9-tap-0-9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.