If you have ever used the program qrencode to generate QR-Codes as SVG files, (e.g. qrencode -t SVG -o test.svg 'yourdata') then you have probably encountered this problem: Between every two adjacent lines of blocks/pixels there seems to be a thin white line.

QR code from qrencode -t SVG rendered to PNG with Inkscape

QR code from qrencode -t SVG rendered to PNG with Inkscape

This is because qrencode builds up svg files line by line using only rectangular black blocks. When two of these blocks are near each other, they should theoretically (as there is no space between them) not have a white line between them. However, due to the attempts of anti-aliasing by the SVG renderer (both rectangles’ edges try to fade to the white background for a smoother image), you see a white line between them.

The obvious solution would be for the adjacent blocks to be merged to one polygon line. Probably due to efficiency-reasons, qrencode doesn’t do that. So I’ll explain to you how to fix this with Inkscape.

Open up the generated SVG file in Inkscape. Select the QR code. Go to “Object”->”Ungroup”. You should now have two  selections: the QR code itself and a bigger white square in the background. Now select only the QR code itself (click outside the image to deselect, then click in the QR code). Go to “Path”->”Combine”. This is it. You can now save the file and don’t have to worry about the white lines anymore.

result: no white lines

QR code after the fix, rendered to PNG with Inkscape.

Some day maybe somebody should look into that qrencode source code and write a patch for “high quality high compatibility svg output” and generate those polygons directly.

Update: There is a patch for this in the pipeline: https://github.com/fukuchi/libqrencode/pull/41
However it is not accepted yet because of unrelated changes it makes and which require the librsvg to be updated.