QR Codes from Google Chart API

The Google Chart API now generates QR Codes.

For example, the following URL results in the QR Code for https://brentlogan.com/.

http://chartserver.apis.google.com/chart?
cht=qr&chs=300x300&chl=https://brentlogan.com/

QR Code for http://blogan.net

Note, the above list URL is shown on two lines for space reasons only. It should be one continuous URL with no spaces.

Interestingly, the <img> form to embed the resulting QR Code in a web page does not (yet?) work. I guess that’s to be expected when using an undocumented feature of the API.

Update: The following now works:

<img src="https://chart.googleapis.com/chart?chs=100x100&cht=qr&chl=https://brentlogan.com/" />

resulting in the image below:

Hat tip: 2d Code via Josh Bancroft’s linkblog.

10 responses to “QR Codes from Google Chart API”

  1. Dean Collins Avatar

    Hi Brent,

    the img form for embed does work for me – are you doing something wrong?

    BTW there are a whole heap of ‘undocumented’ commands (smsto tel email etc) Check out this blog post or my website for more details.

    Cheers,
    Dean

  2. Brent Logan Avatar

    @Dean, thanks. I’ll have to try the <img> form again.

    Well, I’m not sure what I doing wrong, but it doesn’t seem to work. Here’s what I used:

    <img src="https://chartserver.apis.google.com/chart?
    cht=qr&chs=300x300&chl=https://brentlogan.com/">

    As above, I put it on a single line. I’m sure I’m doing something stupid, but I haven’t figured it out, yet.

    I’ll have to check out your site. Btw, I moved your link into the text so it didn’t extend into the margins.

    Update. Hmm… Dean, I went to your site and I don’t see the <img> form working there, either. What’s strange, is that it does work in the PSPad editor’s preview pane.

  3. Dean Collins Avatar

    Hi brent yep it seems to be a blogger issue rather than a chart api issue.

    if you click the links they resolve fine but call on 11 of them in a single web page and it doesn’t work.

    regarding i-nigma, stay away from it. it’s a piece of crap (can you tell i’m very anti url redirection?)

    cheers,
    Dean Collins

  4. Brent Logan Avatar

    It seems to be more than a blogger issue. Google’s implementation of QR codes also doesn’t allow <img> embedding on self-hosted WordPress blogs.

    And I guess you’ll have to explain why you don’t like i-nigma’s implementation. What are you concerned about?

  5. Dean Collins Avatar

    regarding i-nigma – stay away from it, their encoder is a piece of crap.

    i am very anti url-redirection.

    whats the point of having an encoder that relies on a third party server to provide a redirection.

    people need to understand the whole point of qr codes is to have the information embedded in the code, not rely on some third party server to redirect you to the correct site.

    what happens when inigma turns off their server? all the codes you have deployed are screwed.

    or worse – they track how many hits you are getting and turn around and say you need to pay us money otherwise we are going to turn your codes off – holding you hostage.

    url redirection is a shitty trick, dont fall for it.

    stick with one of the other encoders that dont implement redirection into your codes – they’re your codes use them how you want to.

    Cheers,
    Dean

  6. Brent Logan Avatar

    Dean, I see i-nigma doing the same thing that Google does: create a QR code and allow me to either grab the graphic to host myself or grab an embed code so they can host it. The latter is much easier to do. No copying, pasting, saving, and uploading. Does it make me reliant on either Google or i-nigma? Yeah, but I’m just playing with it. If it was that important to me, I’d be willing to go through the work.

    But, to repeat myself, I don’t see it any different from relying on Google to serve any of the graphics they offer in their chart API.

    Maybe I’ve misinterpreted your concerns. If so, please correct me.

  7. Dean Collins Avatar

    I posted a comment a few weeks ago in reply but doesn’t seem to have been posted so here is my reply again.

    google api creates the api but when your reader views it – the browser is delivered the actual url and sent directly to the content.

    inigma is a url redirection encoder.

    meaning when they encode your qr code they dont actually provide your url in the code they provide one of their own urls – which is then redirected to your website. normally something like http://www.i-nigma.com/1234dre4556k

    so if inigma go tits up tomorrow and or withdraw their service (and or start to charge you for it) then you are screwed and all the qr’s you deployed no longer work.

    in the google example, apart from the actual initial encoding google has no ongoing involvement. so if they withdraw their api etc doesn’t matter at all – the qr image sends users directly to your url.

    does that make sense? there is a big difference.

    Inigma are looking to ‘create’ a business model where no problem actually exists in the first place.

    Cheers,
    Dean

  8. Brent Logan Avatar

    Times like this I feel like an idiot. Your sentences look well-formed and you say it with confidence so I assume you’re right. I just don’t understand you.

    I’ll try to explain what I understand and you can correct my gaps in understanding.

    The normal Google Chart API provides access to the charts through an URL. To embed a Google chart within a web page, embed the URL within an <img> tag.

    Right now, Google’s implementation of QR Codes is not documented in its API and embedding a QR Code URL in an <img> tag does not (yet?) work, at least not on any live web page I’ve tried.

    The only way I can get it to work is put the URL directly into the address bar of my browser and then grab the resulting image, upload it to my site, and then embed that image using an <img> tag linking to the image on my site.

    It works, but it’s a pain and it’s not what I consider to be the “standard” way of using the Google Chart API. The standard method of using the Google Chart API makes me reliant on Google not going “tits up” and not charging me for their service.

    Are you considering Google’s gap in implementing QR Codes in its standard API to be its advantage? If so, I don’t understand why, because I-nigma also allows you to capture their QR code image, upload it to your site, link to it, and then I-nigma’s further existence is of no concern.

    Maybe it’s just Friday afternoon and my brain cells have already started their weekend celebration…

  9. Dean Collins Avatar

    lol Brent – yeh sorry I should have picked another encoder rather than google to make my point.

    Yes if they switch off the google api server your tags will no longer work.

    BUT any tags you have saved as images will still work.

    any images you have saved from inigma wont work because when my qr reads inigma it visits their ‘dns like’ server first to ask ‘whats the real url you want me to go to’.

    the same way tinyurl works.

    they say they do this to make the codes shorter (which it does) BUT this also means any codes you print out etc and palce into the wild (bus shelters, print magazines, books etc) will no longer work.

    I can see why you were confused what i was saying about google.

    btw check out quickmark and their freen encoding application. it’s the best I’ve found so far.

    Cheers,
    Dean

  10. Brent Logan Avatar

    Dean, thanks for bearing with me. I think I’m starting to understand.

    It looks like I-nigma may have changed their implementation since you last looked. Their embed URLs look more like Google’s would (if theirs were consistent with the rest of the Google Chart API):

    <img src="https://encode.i-nigma.com/QRCode/img.php
    ?d=URL%3Ahttp%3A%2F%2Fblogan.net&c=&s=6" alt="" />

    I also like how their creator web page suggests downloading the image itself.

    I’ll take a look at Quickmark.