e02a5623492a3eb37b2be68f288042798753086a
[geeqie.git] / doc / docbook / GuideOptionsAdvanced.xml
1 <?xml version="1.0" encoding="utf-8"?>\r
2 <section id="GuideOptionsAdvanced">\r
3   <title>External preview extraction</title>\r
4   <para>\r
5     The intention of this feature is to give the user the possibility to display image previews of files\r
6     that the standard libraries cannot decode.\r
7     <para />\r
8     An example is the .dng files produced by LG V30 cameras. Neither\r
9     <code>exiv2</code>\r
10     nor\r
11     <code>libraw</code>\r
12     can\r
13     extract a preview, but the command line program\r
14     <code>dcraw</code>\r
15     can.\r
16     <para />\r
17     This feature allows a work-around until the standard libraries provide a solution.\r
18     <para />\r
19     Two command files are required: one to identify which files to process, and one to extract or decode the preview image.\r
20     <para />\r
21     The format for the identification tool is:\r
22     <para />\r
23     <pre>\r
24       <programlisting xml:space="preserve">\r
25         Parameter 1: (input) full path name to the current image.\r
26         <para />\r
27         Returns: 0 for file match, any other value for no match.\r
28       </programlisting>\r
29     </pre>\r
30     <para />\r
31     The format for the extraction tool is:\r
32     <para />\r
33     <pre>\r
34       <programlisting xml:space="preserve">\r
35         Parameter 1: (input) full path name to the current image.\r
36         <para />\r
37         Parameter 2: (output) a temporary file name generated by Geeqie. The tool should load this file with the decoded image.\r
38         <para />\r
39         Returns: not used.\r
40       </programlisting>\r
41     </pre>\r
42     <para />\r
43     This is an example of an identification tool using a shell script:\r
44     <para />\r
45     <pre>\r
46       <programlisting xml:space="preserve">#! /bin/bash\r
47 \r
48         filename=$(basename -- "$1")\r
49         extension="${filename##*.}"\r
50 \r
51         shopt -s nocasematch\r
52         if [[ $extension == "DNG" ]]\r
53         then\r
54             cameramodel=$(exiv2 -K Exif.Image.UniqueCameraModel -Pt "$1" )\r
55             if [[ $cameramodel  == "LG-H930" ]]\r
56             then\r
57                 exit 0\r
58             else\r
59                 exit 1\r
60             fi\r
61         else\r
62             exit 1\r
63         fi</programlisting>\r
64     </pre>\r
65   </para>\r
66   <para>\r
67     This is an example of an extraction/decode tool using a shell script:\r
68     <pre>\r
69       <programlisting xml:space="preserve">#! /bin/bash\r
70         dcraw -e -c   "$1" > "$2"</programlisting>\r
71     </pre>\r
72     <para />\r
73     Alternatively:\r
74     <pre>\r
75       <programlisting xml:space="preserve">#! /bin/bash\r
76         gm convert "$1" "$2"</programlisting>\r
77     </pre>\r
78   </para>\r
79   <para>\r
80     If the decode tool requires an output file with a particular extension, use this method:\r
81     <pre>\r
82       <programlisting xml:space="preserve">#! /bin/bash\r
83         tmpfile=$(mktemp --tmpdir=$tempdir geeqie_tmp_XXXXXX.jpg)\r
84         gm convert "$1" $tmpfile\r
85         mv $tmpfile "$2"</programlisting>\r
86     </pre>\r
87   </para>\r
88 </section>\r