# Advanced

## External preview extraction

The intention of this feature is to give the user the possibility to display image previews of files that the standard libraries cannot decode.

An example is the .dng files produced by LG V30 cameras. Neither exiv2 nor libraw can extract a preview, but the command line program dcraw can.

This feature allows a work-around until the standard libraries provide a solution.

Two command files are required: one to identify which files to process, and one to extract or decode the preview image.

The format for the identification tool is:

            Parameter 1: (input) full path name to the current image.
            Returns: 0 for file match, any other value for no match.

The format for the extraction tool is:

            Parameter 1: (input) full path name to the current image.
            Parameter 2: (output) a temporary file name generated by Geeqie.
            Returns: not used.

The tool should load the output file with the decoded image.

This is an example of an identification tool using a shell script:

    #! /bin/bash

            filename=$(basename -- "$1")
            extension="${filename##*.}"

            shopt -s nocasematch
            if [[ $extension == "DNG" ]]
            then
            cameramodel=$(exiv2 -K Exif.Image.UniqueCameraModel -Pt "$1" )
            if [[ $cameramodel  == "LG-H930" ]]
            then
            exit 0
            else
            exit 1
            fi
            else
            exit 1
            fi

This is an example of an extraction/decode tool using a shell script:

    #! /bin/bash
              dcraw -e -c   "$1" > "$2"

Alternatively:

    #! /bin/bash
              gm convert "$1" "$2"

If the decode tool requires an output file with a particular extension, use this method:

    #! /bin/bash
              tmpfile=$(mktemp --tmpdir=$tempdir geeqie_tmp_XXXXXX.jpg)
              gm convert "$1" $tmpfile
              mv $tmpfile "$2"

## Thread Pools

This option will limit the number of threads (cores) that are used when performing a duplicate image search. A value of 0 means use all available threads. This will give the fastest processing time, but will slow other processes including user input response time.

## Alternate Algorithm

Alternate Similarity Algorithm