<?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:
      <programlisting>
        Parameter 1: (input) full path name to the current image.
        Returns: 0 for file match, any other value for no match.
      </programlisting>
      The format for the extraction tool is:
      <programlisting>
        Parameter 1: (input) full path name to the current image.
        Parameter 2: (output) a temporary file name generated by Geeqie.
        Returns: not used.
      </programlisting>
      The tool should load the output file with the decoded image.<para/>
      This is an example of an identification tool using a shell script:
      <programlisting>#! /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>
      <para>
        This is an example of an extraction/decode tool using a shell script:
        <programlisting>#! /bin/bash
          dcraw -e -c   "$1" > "$2"</programlisting>
        Alternatively:
        <programlisting>#! /bin/bash
          gm convert "$1" "$2"</programlisting>
      </para>
      <para>
        If the decode tool requires an output file with a particular extension, use this method:
        <programlisting>#! /bin/bash
          tmpfile=$(mktemp --tmpdir=$tempdir geeqie_tmp_XXXXXX.jpg)
          gm convert "$1" $tmpfile
          mv $tmpfile "$2"</programlisting>
      </para>
    </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>
      <emphasis role="underline"><link linkend="GuideReferenceSimilarityAlgorithms">Alternate Similarity Algorithm</link></emphasis>
    </para>
  </section>
</section>
