A long while ago I wrote about the advantages of Mobile Codes, 2D barcodes that can contain text snippets or URLs that can be interpreted by a camera phone to save the user having to input lots of text on their mobile device. I'm using the term Mobile Codes here to mean both Datamatrix and QR format barcodes. Generating mobile codes is easy, many people will use a service that will be provided on a third party website to input a few details on a web form and have the code generated for them, a good example of such a website is Nokia Mobile Codes. This is great for experimentation, however there might be a slight problem when you come to work on providing a service of your own where you need to generate mobile codes, the terms and conditions of that third party service might rule out using that site. For example, the Nokia site has a list of terms and conditions that say, amoungst other things that "The Service ... may be used solely for private, non-commercial purposes" and "No person under the age of 16...is eligible to use the Service", so if you are a fifteen year old entrepreneur you'll have to get your mobile codes from somewhere else! Fortunately, you can create mobile codes without leaving the comfort of your command line.
These instructions are for Ubuntu systems, but should also work on Debian. Creating an image file containing a mobile code can be done in just two commands, but first we need to install two packages iec16022 and imagemagick to give us the required software, this can be done with this command in a shell:
sudo apt-get install iec16022 imagemagick
The iec16022 package provides a program to generate the mobile code, it is open source software originally written by Andrews and Arnold Ltd. and now maintained by Stefan Schmidt. When you look at the man page (enter man iec16022) for this program you'll see it has various options including one for size, but there is something here that might trip you up; you might want to nice large mobile code to put on your size, maybe 300x300 pixels in size, but if you try to specify this here you will get an error message. This is because most mobile codes are actually scaled up in size from their default size. The program is using one pixel for each piece of information, but mobile codes used on websites or on printed materials might actually use several pixels for that one pixel, you have to specify quite a small size for the option to iec16022 and then use another program to do the scaling.
Generating a mobile code is easy, here is one that will embed the text "Mobile Codes are fun!" into a barcode and output this to an image file called "mymobilecode.png", you can also use an input file to pass the input text if you want, if you use the command line be careful with your quotes to avoid the shell trying to interpret your text:
iec16022 --size=32x32 --barcode='Mobile codes are fun!' --format=PNG --outfile mymobilecode.png
If you want to embed a link instead of text, just speciy a full web address (including the "http://" part) and the reader software should pick it up. The image file you are left with is rather small, too small for most mobile reader software to deal with, so you'll need to scale it up using the mogrify command from the Imagemagick suite of image manipulation tools we installed earlier. This command scales up an image, and modifies the original file. A good size might be 300x300 pixels, big enough for a lot of mobile reader software to pick up. You can use a command like this:
mogrify -scale 300x300 mymobilecode.png
Generating a mobile code this way is very quick and could easily be scripted and might be a useful option if you want to make more use of mobile codes in your developments.
Re: Creating Mobile Codes locally - no web service needed
I really don't think people have thought through this whole concept of mobile codes that are not human readale but can be used to bring up (say) a website.
What happens when somebody starts spreading a goatse mobile code around? How could you possibly respond to that? To prevent that?
Re: Creating Mobile Codes locally - no web service needed
Hi Stephen, the reader software I have used in the past shows you the URL that is embedded in the mobile code and asks your permission before visiting it. Of course this will be meaningless if the URL is very obscure or uses one of the URL shortener services. So possibly meaningful URLs again prove their usefulness in helping people understand what will happen if they follow that link.
Re: Creating Mobile Codes locally - no web service needed
I cannot read your code. I use a barcode reader on my android phone and your code is not in the list of code types that it reads. It seems the QR CODE format is *much* more popular, in many countries. I'd repost your codes in QR CODE format.
Re: Creating Mobile Codes locally - no web service needed
It's in Datamatrix/ISO 16022 format. should be supported by most bar code readers. Interesting what you say about QR code popularity though, I'll have to look into how to generate those locally.