<?xml version="1.0" encoding="utf-8"?>
  <section id="GuideOptionsAdvanced">
<title>Advanced</title>
  <section id="ExternalPreviewExtraction">
     <title>External preview extraction</title>
 <para>
    The intention of this feature is to give the user the possibility to display image previews of files
    that the standard libraries cannot decode.
    <para />
    An example is the .dng files produced by LG V30 cameras. Neither
    <code>exiv2</code>
    nor
    <code>libraw</code>
    can
    extract a preview, but the command line program
    <code>dcraw</code>
    can.
    <para />
    This feature allows a work-around until the standard libraries provide a solution.
    <para />
    Two command files are required: one to identify which files to process, and one to extract or decode the preview image.
    <para />
    The format for the identification tool is:
    <para />
    <pre>
      <programlisting xml:space="preserve">
        Parameter 1: (input) full path name to the current image.
        <para />
        Returns: 0 for file match, any other value for no match.
      </programlisting>
    </pre>
    <para />
    The format for the extraction tool is:
    <para />
    <pre>
      <programlisting xml:space="preserve">
        Parameter 1: (input) full path name to the current image.
        <para />
        Parameter 2: (output) a temporary file name generated by Geeqie. The tool should load this file with the decoded image.
        <para />
        Returns: not used.
      </programlisting>
    </pre>
    <para />
    This is an example of an identification tool using a shell script:
    <para />
    <pre>
      <programlisting xml:space="preserve">#! /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</programlisting>
    </pre>
  </para>
  <para>
    This is an example of an extraction/decode tool using a shell script:
    <pre>
      <programlisting xml:space="preserve">#! /bin/bash
        dcraw -e -c   "$1" > "$2"</programlisting>
    </pre>
    <para />
    Alternatively:
    <pre>
      <programlisting xml:space="preserve">#! /bin/bash
        gm convert "$1" "$2"</programlisting>
    </pre>
  </para>
  <para>
    If the decode tool requires an output file with a particular extension, use this method:
    <pre>
      <programlisting xml:space="preserve">#! /bin/bash
        tmpfile=$(mktemp --tmpdir=$tempdir geeqie_tmp_XXXXXX.jpg)
        gm convert "$1" $tmpfile
        mv $tmpfile "$2"</programlisting>
    </pre>
  </para>
</section>
<section id="ThreadPools">
    <title>Thread Pools</title>
    <para>This option will limit the number of threads (cores) that are used when performing a duplicate image search. A value of <code>0</code> means use all available threads. This will give the fastest processing time, but will slow other processes including user input response time.</para> 
</section>
<section id="AlternateAlgorithm">
    <title>Alternate Algorithm</title>
    <para><link linkend="GuideReferenceSimilarityAlgorithms">Alternate Similarity Algorithm</link></para>
</section>
</section>
