summaryrefslogtreecommitdiffstats
path: root/doc/ref/zbarimg.xml
blob: 572bea946e31b5e4b3bb27b4fdf1957daeae6033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<refentry xml:id="zbarimg"
  xmlns:xlink="http://www.w3.org/1999/xlink">

  <refmeta>
    <refentrytitle>zbarimg</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>zbarimg</refname>

    <refpurpose>scan and decode bar codes from image file(s)
    </refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>zbarimg</command>
      <arg><option>-qv</option></arg>
      <arg><option>--polygon</option></arg>
      <arg><option>--quiet</option></arg>
      <arg><option>--verbose<arg>=<replaceable
      class="parameter">n</replaceable></arg></option></arg>
      <sbr/>
      <group choice="req" rep="repeat">
        <arg choice="plain"><option>-dD</option></arg>
        <arg choice="plain"><option>--display</option></arg>
        <arg choice="plain"><option>--nodisplay</option></arg>
        <arg choice="plain"><option>--xml</option></arg>
        <arg choice="plain"><option>--noxml</option></arg>
        <arg choice="plain"><option>-S<optional><replaceable
            class="parameter">symbology</replaceable>.</optional><replaceable
            class="parameter">config</replaceable><optional>=<replaceable
            class="parameter">value</replaceable></optional></option></arg>
        <arg choice="plain"><option>--set <optional><replaceable
            class="parameter">symbology</replaceable>.</optional><replaceable
            class="parameter">config</replaceable><optional>=<replaceable
            class="parameter">value</replaceable></optional></option></arg>
        <arg choice="plain"><replaceable>image</replaceable></arg>
      </group>
    </cmdsynopsis>

    <cmdsynopsis>
      <command>zbarimg</command>
      <group choice="req">
        <arg choice="plain"><option>-h</option></arg>
        <arg choice="plain"><option>--help</option></arg>
        <arg choice="plain"><option>--version</option></arg>
      </group>
    </cmdsynopsis>
  </refsynopsisdiv>

  <refsection>
    <title>Description</title>

    <para>For each specified
    <filename><replaceable>image</replaceable></filename> file
    <command>zbarimg</command> scans the image for bar codes and
    prints any decoded data to stdout.  Images may optionally be
    displayed to the screen.</para>

    <para>The underlying library currently supports EAN-13 (including
    UPC and ISBN subsets), EAN-8, DataBar, DataBar Expanded, Code 128,
    Code 93, Code 39, Codabar, Interleaved 2 of 5 and QR Code symbologies.
    The specific type of each detected symbol is printed with the decoded
    data.</para>

    <para>Note that "<filename><replaceable>image</replaceable></filename>"

    in this context refers to any format supported by ImageMagick,
    including many vector formats such as PDF and PostScript.  Keep in
    mind that vector formats are rasterized before scanning; manually
    rasterize vector images before scanning to avoid unintentionally
    corrupting embedded barcode bitmaps.</para>

  </refsection>

  <refsection>
    <title>Options</title>

    <para>This program follows the usual GNU command line syntax.
    Single letter options may be bundled, long options start with two
    dashes (`-').</para>

    <variablelist>
      &refcommonoptions;

      <varlistentry>
        <term><option>--polygon</option></term>
        <listitem>
          <simpara>Ouput points of the polygon containing the code bar.
          Using a format compatible with The &lt;polygon&gt; element
          of the Scalable Vector Graphics (SVG) markup language</simpara>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-q</option></term>
        <term><option>--quiet</option></term>
        <listitem>
          <simpara>Quiet operation; only output decoded symbol data.
          specifically this disables the statistics line printed (to
          stderr) before exiting, as well as the warning message
          printed (also to stderr) when no barcodes are found in an
          image</simpara>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>-d</option></term>
        <term><option>--display</option></term>
        <term><option>-D</option></term>
        <term><option>--nodisplay</option></term>
        <listitem>
          <simpara>Enable/disable display of subsequent
          <filename><replaceable>image</replaceable></filename> files,
          until next <option>--display</option> or
          <option>--nodisplay</option> is encountered.  This option
          may appear multiple times to enable display of specific
          images.  Image display is disabled by default</simpara>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--xml</option></term>
        <term><option>--noxml</option></term>
        <listitem>
          <simpara>Enable/disable result output using an XML format.
          This format wraps the raw data from the symbol with
          information about the scan (such as page indices) in an
          easy to parse format.  The latest schema is available from
          <link xlink:href="http://zbar.sourceforge.net/2008/barcode.xsd"/>.</simpara>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><option>--raw</option></term>
        <listitem>
          <simpara>Enable raw symbol data output.  This format prints symbol
          data separated by newlines without the additional symbology type
          information that is printed by default</simpara>
        </listitem>
      </varlistentry>

    </variablelist>
  </refsection>

  <refsection>
    <title>Examples</title>

    <para>Scan a PNG image of a UPC bar code symbol and pass
    resulting data to a script that searches for the code in a
    database and does something useful with it:

    <screen><command>zbarimg</command> <filename>product.png</filename> | <command>upcrpc.py</command></screen>

    The <command>upcrpc.py</command> example script included in the
    <filename>examples/</filename> subdirectory of the distribution
    will make an XMLRPC call to a popular internet UPC database and
    print the product description if found.</para>

    <para>Scan a JPEG image containing several barcodes and display
    the image in a window, also disabling recognition of Interleaved 2
    of 5 codes to prevent confusion with other symbologies or
    background noise:

      <screen><command>zbarimg</command> <option>--display</option> <option>-Si25.disable</option> <filename>label.jpg</filename></screen>
    </para>

    <para>Look in a scanned document only for Code 39, using XML
    output format so the page numbers are available.  To enable only
    Code 39, first all symbologies are disabled, then Code 39 is
    re-enabled:

      <screen><command>zbarimg</command> <option>--xml</option> <option>-Sdisable</option> <option>-Scode39.enable</option> <filename>scan.tiff</filename></screen>
    </para>
  </refsection>

  <refsection>
    <title>Exit Status</title>

    <para><command>zbarimg</command> returns an exit code to indicate the
    status of the program execution. Current exit codes are:</para>

    <variablelist>
      <varlistentry>
        <term>0</term>
        <listitem>
          <para>Barcodes successfully detected in all images. Warnings may
          have been generated, but no errors.</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>1</term>
        <listitem>
          <para>An error occurred while processing some image(s).  This
          includes bad arguments, I/O errors and image handling errors from
          ImageMagick.</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>2</term>
        <listitem>
          <para>ImageMagick fatal error.</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>3</term>
        <listitem>
          <para>The user quit the program before all images were scanned.
          Only applies when running in interactive mode
          (with <option>--display</option>)</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>4</term>
        <listitem>
          <para>No barcode was detected in one or more of the images.  No
          other errors occurred.</para>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsection>

  <refsection>
    <title>See Also</title>
    <para><xref linkend="zbarcam"/></para>
    <para><link xlink:href="http://zbar.sf.net/"/></para>
  </refsection>

  <refsection>
    <title>Bugs</title>

    <para>See <link xlink:href="http://sf.net/tracker/?group_id=189236&amp;atid=928515"/></para>

  </refsection>

</refentry>