{"id":1338,"date":"2009-10-27T11:01:47","date_gmt":"2009-10-27T11:01:47","guid":{"rendered":"http:\/\/www.bardecode.com\/en1\/?p=1338"},"modified":"2013-02-12T11:02:31","modified_gmt":"2013-02-12T11:02:31","slug":"bardecode-shell-tool","status":"publish","type":"post","link":"https:\/\/www.bardecode.com\/en1\/bardecode-shell-tool\/","title":{"rendered":"bardecode shell tool"},"content":{"rendered":"<p>The bardecode command provides an interface to the barcode reader toolkit from the shell. For example, the following command will scan an image file for barcodes and print the values:<\/p>\n<p><strong>bardecode -t any -m -f somefile.tif<\/strong><\/p>\n<p>Options are flags such as -m, which may or may not take an argument<br \/>\nlong options are property name and value pairs, such as &#8211;MinSpaceBarWidth=2<\/p>\n<p>options are:<\/p>\n<table border=\"0\">\n<tbody>\n<tr>\n<td>-C max_length<\/td>\n<td>Maximum length of barcode<\/td>\n<\/tr>\n<tr>\n<td>-c min_length<\/td>\n<td>Minimum length of barcode<\/td>\n<\/tr>\n<tr>\n<td>-d scan_direction<\/td>\n<td>Scan direction mask 1 = Left to Right, 2 = Top to Bottom 4 = Right to Left and 8 = Bottom to Top. default is 15. The scan direction mask controls the directions in which the barcode reader will look for a barcode. With this version it it now possible to scan for barcodes in any rotation with one call to the reader.<\/td>\n<\/tr>\n<tr>\n<td>-f image_file<\/td>\n<td>image_file can be of type TIF or JPG. JPG files must use the extension &#8220;.jpg&#8221; or &#8220;.jpeg&#8221;<\/td>\n<\/tr>\n<tr>\n<td>-g<\/td>\n<td>Process files and folders from the XML file specified with<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>-x flag. See below for more details.<\/td>\n<\/tr>\n<tr>\n<td>-i page_index<\/td>\n<td>Page number of image indexed from 1<\/td>\n<\/tr>\n<tr>\n<td>-j jump<\/td>\n<td>Frequency at which scan lines are sampled, default is 1<\/td>\n<\/tr>\n<tr>\n<td>-k skew tolerance<\/td>\n<td>Skew tolerance 0 = off to 5 = any angle<\/td>\n<\/tr>\n<tr>\n<td>-L oversample_sep<\/td>\n<td>Distance between the line samples when over-sampling is used. Default value is 3.<\/td>\n<\/tr>\n<tr>\n<td>-M min_space_width<\/td>\n<td>Minimum allowed size in pixels for a space between bars<\/td>\n<\/tr>\n<tr>\n<td>-m<\/td>\n<td>Scan for multiple barcodes<\/td>\n<\/tr>\n<tr>\n<td>-N noise_reduction<\/td>\n<td>Advanced Noise Reduction (0 = off, typical value is 20)<\/td>\n<\/tr>\n<tr>\n<td>-n noise_reduction<\/td>\n<td>Noise Reduction level (0 = off, typical value is 20)<\/td>\n<\/tr>\n<tr>\n<td>-O<\/td>\n<td>Sample the scan lines in blocks of 3 with each line separated by oversample_sep lines (see below).<\/td>\n<\/tr>\n<tr>\n<td>-o min_occurs<\/td>\n<td>Minimum number of matching scan lines, default 2<\/td>\n<\/tr>\n<tr>\n<td>-P<\/td>\n<td>Show page numbers<\/td>\n<\/tr>\n<tr>\n<td>-p pref_occurs<\/td>\n<td>Preferred number of matching scan lines, default 5<\/td>\n<\/tr>\n<tr>\n<td>-q quiet_size<\/td>\n<td>Number of pixels wide for the quiet zone around bar code<\/td>\n<\/tr>\n<tr>\n<td>-R pattern<\/td>\n<td>Barcodes must match regular expression defined by pattern -r x1,y1,x2,y2,m<\/td>\n<td>Rectangle for scanning (see below for details)<\/td>\n<\/tr>\n<tr>\n<td>-S file_template:<\/td>\n<td>Split a multi-page TIF file into smaller TIF files.<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>The first page of each new file will contain a barcode<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>The template must include %d to index the files<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>e.g. file%d.tif. Must be used with -m flag.<\/td>\n<\/tr>\n<tr>\n<td>-T color_threshold<\/td>\n<td>Set the color threshold<\/td>\n<\/tr>\n<tr>\n<td>-t barcode_types<\/td>\n<td>Specifies the types of barcodes to read, barcode_types is one or more of &#8220;code39&#8221;, &#8220;code128&#8221;, &#8220;upca&#8221;, &#8220;upce&#8221;, &#8220;ean8&#8221;, &#8220;code25&#8221;, &#8220;ean13&#8221; and &#8220;codabar&#8221; joined together with the | character.<\/td>\n<\/tr>\n<tr>\n<td>-t any<\/td>\n<td>Searches for a barcode of any type e.g &#8220;code39|code128&#8221;<\/td>\n<\/tr>\n<tr>\n<td>-u upper_ratio<\/td>\n<td>Defunct flag<\/td>\n<\/tr>\n<tr>\n<td>-w<\/td>\n<td>Print TIF Warnings to STDERR<\/td>\n<\/tr>\n<tr>\n<td>-X xml_output<\/td>\n<td>Output results to specified XML file (see below)<\/td>\n<\/tr>\n<tr>\n<td>-x xml_input<\/td>\n<td>Load settings from specified XML file (see below)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The long options give access to all the features of the toolkit.<\/p>\n<p>Supported long options properties are: AllowDuplicateValues, Code39Checksum,<br \/>\nCode39NeedStartStop, ColorThreshold, ConvertEAN13ToUPCE, Debug, Despeckle,<br \/>\nErrorCorrection, ExtendedCode39, LineJump, MaxLength, MedianFilter, MinLength,<br \/>\nMinOccurrence, MinSeparation, MinSpaceBarWidth, MultipleRead, NoiseReduction<br \/>\nOverSamplingSeparation, PrefOccurrence, QuietZoneSize, PageNo, Pattern,<br \/>\nReadCodabar, ReadCode128, ReadCode25, ReadCode25ni, ReadCode39,ReadDataMatrix<br \/>\nReadEAN8, ReadEAN13, ReadNumeric, ReadPatchCodes, ReadPDF417, ReadUPCA<br \/>\nReadUPCE, ScanDirection, ShowCheckDigit, SkewTolerance, TifSplitMode<br \/>\nTifSplitPath and UseOverSampling.<\/p>\n<p>Please refer to the product documentation for descriptions and appropriate<br \/>\nvalues.<\/p>\n<p>Rectangle argument:<\/p>\n<p>The top left hand corner of an image is the origin and (x1,y1) (x2,y2) define the<br \/>\ntop left and bottom right corners of the rectangle to be searched &#8211; with the<br \/>\nmeasurements taken in either pixels or a percentage of the width\/height of the image.<br \/>\nIf m = 0 then the units are pixels and if m = 1 then the units are as a percentage.<br \/>\nExample: To search top right hand quarter of an image use -m50,0,100,50,1<\/p>\n<p>XML Input and Output<\/p>\n<p>Settings and results can be stored in XML format. Multiple layers of settings<br \/>\ncan be specified, with the toolkit trying each successive layer until a barcode<br \/>\nis found. For more details please refer to the manual pages for LoadXMLSettings<br \/>\nand SaveResults. If the -g flag is also used then any files or folders specified<br \/>\nin the input file are processed, as described in the manual page for ProcessXML.<\/p>\n<p>Examples:<\/p>\n<p>Scan for a Code 39 barcode in a portrait orientation image:<\/p>\n<p>bardecode -f file.tif -t code39 -d 5<\/p>\n<p>Using long options:<\/p>\n<p>bardecode -f file.tif &#8211;ReadCode39=1 &#8211;ScanDirection=5<\/p>\n<p>Scan for a Code 39 barcode in a landscape orientation image:<\/p>\n<p>bardecode -f file.tif -t code39 -d 10<\/p>\n<p>Scan for a Code 128 or UPC-A barcode in an image of poor quality:<\/p>\n<p>bardecode -n 20 -f file.tif -t &#8220;code128|upca&#8221;<\/p>\n<p>Split a multi-page TIF file into smaller files, each with a barcode on page 1<\/p>\n<p>bardecode -t code39 -m -S output%d.tif -f multipage.tif<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The bardecode command provides an interface to the barcode reader toolkit from the shell. For example, the following command will scan an image file for barcodes and print the values: bardecode -t any -m -f somefile.tif Options are flags such as -m, which may or may not take an argument long options are property name<\/p>\n<p><a href=\"https:\/\/www.bardecode.com\/en1\/bardecode-shell-tool\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[236,18],"tags":[],"class_list":["post-1338","post","type-post","status-publish","format-standard","hentry","category-documentation-for-our-toolkits-and-applications","category-knowledge-base"],"_links":{"self":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/1338"}],"collection":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/comments?post=1338"}],"version-history":[{"count":1,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/1338\/revisions"}],"predecessor-version":[{"id":1339,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/1338\/revisions\/1339"}],"wp:attachment":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media?parent=1338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/categories?post=1338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/tags?post=1338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}