Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Ensure the tile width and height values are integers. #14

wants to merge 1 commit into from

2 participants


This should address the issue here:


Currently, if the specified width / number of calculated modules is a non-integer value, fillRect() will attempt a sub-pixel draw resulting in artifacts between the rendered tiles.

By flooring the tile width and height, this problem should be alleviated.


can you give some values for me to reproduce this issue ?


The barcode strings I'm working with are about 20 characters long, and I see the artifacts when I try rendering anything with a larger size of 200px.

I see this in Chrome, Safari, and Mobile Safari. Here's what it looks like in Chrome:

And here are the parameters I used:

        render  : "canvas",
        text    : "12345678901234567890",
        width   : 400,
        height  : 400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 3, 2011
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/jquery.qrcode.js
4 src/jquery.qrcode.js
@@ -28,8 +28,8 @@
var ctx = canvas.getContext('2d');
// compute tileW/tileH based on options.width/options.height
- var tileW = options.width / qrcode.getModuleCount();
- var tileH = options.height / qrcode.getModuleCount();
+ var tileW = Math.floor(options.width / qrcode.getModuleCount());
+ var tileH = Math.floor(options.height / qrcode.getModuleCount());
// draw in the canvas
for( var row = 0; row < qrcode.getModuleCount(); row++ ){
Something went wrong with that request. Please try again.