{"id":493,"date":"2012-11-23T10:05:59","date_gmt":"2012-11-23T10:05:59","guid":{"rendered":"http:\/\/www.bardecode.com\/en1\/?p=493"},"modified":"2013-03-05T11:30:45","modified_gmt":"2013-03-05T11:30:45","slug":"minimum-width-and-height-for-barcodes-in-images","status":"publish","type":"post","link":"https:\/\/www.bardecode.com\/en1\/minimum-width-and-height-for-barcodes-in-images\/","title":{"rendered":"Minimum width and height for barcodes in images"},"content":{"rendered":"<p>The main requirement is for each black or white bar in a barcode to be clearly visible on the image. All barcodes have at least 2 sizes of bar and the image needs to be of high enough quality to show this. For example, a Code 39 barcode consists of 9 bars per character, of which 3 must be wide and 6 must be narrow. The wide bars should be around 2.5 times the size of the narrow bars &#8211; but for simplicity we will say 2 times the size. This means that each character needs at least 12 pixels in an image. This assumes that each pixel in the image lies either entirely in a black bar or entirely in a white bar. In practise, this isn&#8217;t possible and so the resolution should allow around 24 pixels per character.<\/p>\n<p>So, to encode a string of 10 characters (not including the start and stop *) you will need at around 288 pixels. If the barcode is 1 inch wide on the paper then you will need to scan at a resolution of around 300 DPI. If the barcode is 2 inches wide then you will need to scan at a resolution of around 200 DPI.<\/p>\n<p>Some types of barcode have more than 2 widths of bar and a higher resolution still will be needed to ensure that the different widths can be distinguished on the image.<\/p>\n<p>As for barcode height &#8211; if you have a very wide barcode then you need to ensure that it is high enough to cope with any skewing that takes place when the image is scanned.<\/p>\n<p>In summary &#8211; the success of a project can depend on specifying the correct barcode size and image resolution.<\/p>\n<table id=\"Table4\" border=\"0\">\n<tbody>\n<tr>\n<th align=\"left\">Barcode Type<\/th>\n<th>Number of Characters<\/th>\n<th>Minimum Number of Pixels (approx)<\/th>\n<\/tr>\n<tr>\n<td>Code 39<\/td>\n<td>10<\/td>\n<td>288<\/td>\n<\/tr>\n<tr>\n<td>Code 2 of 5 (interleaved)<\/td>\n<td>10<\/td>\n<td>156<\/td>\n<\/tr>\n<tr>\n<td>Code 128 (code set A)<\/td>\n<td>10<\/td>\n<td>286<\/td>\n<\/tr>\n<tr>\n<td>Code 128 (code set B)<\/td>\n<td>10<\/td>\n<td>286<\/td>\n<\/tr>\n<tr>\n<td>Code 128 (code set C)<\/td>\n<td>10<\/td>\n<td>176<\/td>\n<\/tr>\n<tr>\n<td>EAN-13<\/td>\n<td>13<\/td>\n<td>166<\/td>\n<\/tr>\n<tr>\n<td>EAN-8<\/td>\n<td>8<\/td>\n<td>118<\/td>\n<\/tr>\n<tr>\n<td>UPC-A<\/td>\n<td>12<\/td>\n<td>166<\/td>\n<\/tr>\n<tr>\n<td>UPC-E<\/td>\n<td>8<\/td>\n<td>102<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>The main requirement is for each black or white bar in a barcode to be clearly visible on the image. All barcodes have at least 2 sizes of bar and the image needs to be of high enough quality to show this. For example, a Code 39 barcode consists of 9 bars per character, of<\/p>\n<p><a href=\"https:\/\/www.bardecode.com\/en1\/minimum-width-and-height-for-barcodes-in-images\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":341,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,18],"tags":[19,24,23,26,25,20,27,21,28,22],"class_list":["post-493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-image","category-knowledge-base","tag-barcode","tag-barcode-height","tag-barcode-width","tag-code-128","tag-code-39","tag-knowledge","tag-pixels","tag-programming","tag-resolution","tag-solution"],"_links":{"self":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/493"}],"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=493"}],"version-history":[{"count":7,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/493\/revisions"}],"predecessor-version":[{"id":496,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/posts\/493\/revisions\/496"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media\/341"}],"wp:attachment":[{"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/media?parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/categories?post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bardecode.com\/en1\/wp-json\/wp\/v2\/tags?post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}