2D barcodes, QR codes, etc

QR codes are a sort of two-dimensional barcodes. It's quite much a de-facto standard for mobiles in Japan and is gaining in popularity world-wide. Some people incorrectly assume that "QR codes" and "2D barcodes" are synonyms, however there're dozens of 2D barcode formats/standards and QR code is just one of them (check out the Wikipedia page for an extensive list of 2D barcode formats). QR codes can hold all sorts of content, not just numbers, text or URLs (which is the most common use of QR codes). They can hold up to 2953 bytes so small icons, images are also embeddable. Smile

I've tested the built-in barcode reader of my Nokia N95 8GB: it could read successfully only the standard QR codes and failed to read any of the crippled ones in the Wikipedia article (those that got some data removed, but should be still decodable due to the Read-Solomon coding used in QR codes). I could not read the one with the face design either. It seems I'll have to look for a better barcode reader. Smile

Here're some articles/websites on 2D barcodes (mostly related to mobile application):
Some barcode generators:
And some barcode readers for mobiles:
Since Glass is told not to support the N95, I did not even bother trying it. I've tested the other four apps though using the test QR codes that are available on the Wikipedia page.

Here're my results:
  • Nokia's Barcode Reader: quite nice, but it could read only the source image. Supports more 2D barcode formats (not sure which ones) and thus it's a bit slow in recognition.
  • Kaywa Reader: fast and this was the only one that could read one of the non-standard images, namely the one with the face design.
  • UpCode: fast and this is the only one that can read "regular" 1D barcodes too, but in 2D it could read only the source image.
  • Semacode: this one is quite poor. It's written in Java and I suppose that's the reason for it not being able to continuously capture and analyze the image of the camera (like all the other barcode readers do). You can only position the camera and select "Capture". Then the phone asks you (every time) whether you allow the Semacode app. to use your camera and if you select "yes", then (and only then) it takes a shot and analyzes it. I could not read any single QR code using this app, but that's probably my mistake. However this annoying thing with asking for Java permission makes it quite a pain to use.
  • QuickMark: good error correction, but still did not manage to recognize any of the "damaged" barcodes. Did not even recognize the face design code.
It was interesting to see that the i-nigma reader has the same settings and behaviour (while having its own look due to customized background image, fonts, etc.) and decoding capabilities as the Kaywa reader. Smile And the i-nigma reader could decode the face design QR code too! All these similiarities cannot be coincidental. After a little Google search it turned out that both use the reader (or the SDK) of 3GVision. Actually i-nigma.com belongs to 3GVision. Smile

Surprisingly none of the readers could decode any part of the "damaged" QR codes (this and this). Sad

Imho the best QR code reader is Kaywa (since it's the only one in my test that could read something that the others could not) and the most versatile (supporting 1D barcodes too) is UpCode.

PS: I've replaced the default Drupal logo on my site with a QR code. Smile It's quite interesting that non of the barcode reader apps could decode my QR code with default settings (except for QuickMark, but it had "close up" focusing as default). Shock I assume that the gradient background behind the logo is responsible for this, because if I load only the logo image in Firefox, then all readers managed to decode. However on the page (with the gradient background) the Nokia Barcode Reader failed completely, the Kaywa Reader could decode it once I've set the "scan mode" from normal to "close up", and UpCode succeeded once I've set the zoom level to 30%. So if you've problems reading a barcode, play with these settings to improve the chances of success. Another interesting thing is that Nokia Barcode Reader and Kaywa Reader both managed to display the latin1 "ü" character as it was meant (I created the QR code with Nokia's barcode generator so I've no idea about the encoding used), but UpCode displayed this char as the string "ü". Shock

PS2: it's not quite trivial ... UpCode does no autodetection on the barcode format. You've to select the format that is to be recognized manually and the default format is DataMatrix (DM). UpCode can read 1D barcodes, but supports only the UPC-A, UPC-E, EAN/JAN-8 and EAN/JAN-13 variants. These are used for most products in stores, but you cannot read eg. the Wikipedia barcode, because it's encoded with Code 128. Sad Nobody's perfect.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


I've found another 2D barcode reader: Scanlife. Of course my carrier company was not listed there, so I visited getscanlife.com in the browser of my N95 and downloaded the appropriate Symbian installer from there. It seems that Scanlife's app is not a generic 2D-barcode reader, because it failed to read any kind of QR codes or DataMatrix codes ... at least for me. I've tried it really hard, but without any success. I've found posts on various websites which indicate that Scanlife once had an app called "Optical Intelligence" that could read all sorts of 2D barcodes and (!) a lot of 1D barcodes too (more formats than UpCode knows). However the currect Scanlife application is "crippled". Maybe it can read only the company's proprietary barcode format called "EZ Code". Shock

QR code programming

If you're interested in encoding/decoding QR codes, then take a look at the QR Code Library on the Japanese Sourceforge page. The project itself is good for learning too, but the project page contains a lot of useful links. I've tested the current (0.9) version of this library with the Wikipedia QR codes and it succeeded only with the original image and failed with both damaged images and the face design QR code too. But at least it worked with an intact QR code. Smile

Google Android's barcode reader

Finally I've found an app that is capable of decoding 1D barcodes encoded with Code 93 and Code 128, and that I can run on Symbian phones (or at least on my N95). It turned out that Google's Android is going to have a built-in barcode reader application. It's name is ZXing ("Zebra Crossing"), it's written in Java and is quite much in alpha/beta phase. However I managed to get it working (v0.7, since it's the latest at the time of writing), both the command line version and the JavaME version.

It appears that barcode decoding is not yet perfect. The command line version could decode only the original Wikipedia QR code example and none of the others (including the "damaged" QR codes, the face design code and the QR code of my website). It failed to decode the Code 128 and Code 93 examples from the Wikipedia barcode page as well. Scaling up the images helped somewhat, this way it could decode the Code 128 Wikipedia barcode and the QR code of my site too. However I could not make it to decode the Code 93 Wikipedia example (despite that according to the ZXing project page it supports Code 93 barcodes - update: it was my mistake ... ZXing supports Code 39 and not Code 93) and the face design QR code (which was successfully decoded by the Kaywa reader previously). Btw.

The JavaME application has other issues too. First of all, it's a Java app and as such, it asks for permission whenever it tries to access the camera. The other problem is that for some reason I see only the upper half of the camera image on the N95's display, there's no menu, help or instructions of any sort. So in this form it's pretty much unusable ... it's more like a proof of concept.

But I'm confident that this app will grow up and meet my expectations. Smile

PS: there's an Interesting Links page on the project page of ZXing full of useful staff regarding barcode reading. Smile

PS2: I've tested ZXing's 1D-barcode reading capabilities using barcodes from barcoding.com.

PS3: I've revisited ZXing (the JavaME version that is available at the moment - ie. on 27th June 2009), but the JavaME version was not able to decode the QR code of my site. However it was able to decode the Wikipedia QR code. I've done the test of these two with the very same resolution of images, same display (using Xee on my Mac with a black background), so I assume that the JavaME ZXing had a problem with contents of my QR code. The Wikipedia QR code contains only a web address, while mine contains my nickname, my website's address and my email address (all separated by commas). So there's still a way to go for ZXing. On their GetTheReader page they clearly state that only the Android and iPhone versions are actively developed and tested so it's no wonder that the JavaME version does not excel.

In reply to the comment

In reply to the comment about zxing (I am a developer) -- we support Code *39*, not Code *93*. Some Nokias have a bug wherein "full screen" mode is not full screen. I don't know how to work around it. (Also, the N95 does not actually allow J2ME to access focus control, despite supporting JSR-234). The wikipedia example doesn't work as an *SVG* file -- Java doesn't parse it properly. If you save it as another format it works. Thanks!

Re: In reply to the comment

Thanks for correcting me. I've checked v0.7 of ZXing (the version that I used for testing at the time I wrote that comment) and indeed it supports Code 39 (and not Code 93). That pretty much explains why it was not able to decode a Code 93 barcode. Smile As for the problem with N95's implementation of JSR-234 ... unfortunately I had to face similiar issues with other phones too. Most phone vendors (not just Nokia) do not properly implement support for the various JSRs that they claim to support. Sad

Re: Google Android's barcode reader (ZXing)

I've installed the latest version (4.0) of ZXing on my new Galaxy Nexus phone and it rocks. Smile I've scanned all barcodes that I could find at my workplace and at home, and ZXing read all of them. I even had partial success reading barcodes in the dark (by turning on the LED option in the settings of the app and trying very hard ... like 5 minutes). Smile I must admit: ZXing come out to be one of the best barcode readers on Android (and possibly one of the best on all platforms).

P.S.: after having scanned a hundred or so barcodes I've finally found one that ZXing couldn't read. Wink It's on the back of a Creative MuVo V200 mp3 player. The barcode has nothing special about it, but it's on a shiny, metallic sticker which probably messes with the camera. So if I took a picture of the code with a proper camera, ZXing would probably get it right. Smile

Making barcode reading easier

I've found that a 62x62 size QR code on my page is too small (at least on my 30" ACD screen) for most barcode reader apps to decode. I've added a small JQuery script to my template that shows a magnified version (3x the size with wider borders) in the middle of the screen. This one all of the readers managed the decode with default settings. Smile

Here's the JS code if somebody's interested:
$(document).ready(function() {
  $('#logo').hover(function() {
    var $img = $('<img id="logoMagnified">');
    var img = $img.get(0);
    var scale = 3;
    $img.load(function() {
      var img = $(this).get(0);
      img.width = img.width * scale;
      img.height = img.height * scale;
        position: 'absolute',
        border: '10px solid #ffffff',
        right: '50%',
        bottom: '50%',
        marginBottom: Math.round(img.height / -2) + 'px',
        marginRight: Math.round(img.width / -2) + 'px',
        zIndex: 30000
    img.src = this.src;
  }, function() {
    $('#logoMagnified').fadeOut('fast', function() {

Update: on the 19" LCD (with the resolution set to 1024x768) at my office I could decode the QR code with all the readers I've tested (the Nokia, the Kaywa and the UpCode). It seems that barcode reading from the screen pretty much depends on the screen size and the resolution ... which is trivial of course, it's just I didn't expect any problems with a QR code of the size of a smaller stamp. Obviously reading from the screen requires a bit larger QR code than reading from a printed stuff (like paper or clothing).

I use quickmark for

I use quickmark for iPhone(3.8.8 ) and it can decode the face design like http://en.wikipedia.org/wiki/Image:DesignQR.png

Syndicate content