# Deactivating Anti-Aliasing when typesetting QR-Code

Using the following LaTeX-Code:

\documentclass[a4paper]{article}

\usepackage[pdf]{pstricks}
\usepackage{pst-barcode}

\begin{document}
\begin{pspicture}(0.7in,0.7in)
\psbarcode{01234567890}{eclevel=L}{qrcode}
\end{pspicture}
\end{document}


and pdflatex with "shell-escape" option

pdflatex -shell-escape QRCode.tex


a PDF containing the QR-Code is created. However, the QR-Code is anti-aliased. How can I turn off anti-aliasing?

I am using MacTeX (TeX-Live 2010) on Mac OS X 10.6

-
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. –  Martin Scharrer Jun 27 '11 at 17:43
AFAIK anti-aliasing is a feature of the PDF viewer and not influenced by LaTeX. You need to manually switch it off in your viewer. See also the related post My pixel perfect picture gets blurry when compiled in LaTeX, which is about images which look blurry. –  Martin Scharrer Jun 27 '11 at 17:48
Another question is why a programmatically generated image is embedded in raster, not vector, format. –  Andrey Vihrov Jul 24 '11 at 12:42

AFAIK anti-aliasing is a feature of the PDF viewer and not influenced by LaTeX. You need to manually switch it off in your viewer. See also the related post My pixel perfect picture gets blurry when compiled in LaTeX, which is about images which look blurry.

-
I would support this. The example looks very crisp regardless of zoom level on PDF viewer Evince on Ubuntu, for example. –  kongo09 Sep 4 '11 at 11:24
When I turn off anti-aliasing in a Mac OS X 10.6 application Preview, it remains almost the same (like a small raster image). Adobe Acrobat 9 Pro produces a clear image (even with anti-aliased text), though. EAN codes, for example, are shown correctly in both viewers. What could be the cause in this case? –  Harold Cavendish Sep 4 '11 at 18:41
The Barcode Writer in Pure PostScript (BWIPP) library that pst-barcode uses would generate matrix-style barcodes using the PostScript imagemask operator which certain viewers (such as Preview on Mac) incorrectly* choose to interpolate.
For a bit of history, BWIPP switched away from the PostScript image operator in version 2008-12-07 because an increasing number of PS and PDF previewers began to interpolate its output. The replacement imagemask operator worked better for a time, but was clearly not perfect, so BWIPP has switched to using a filled path in version 2014-01-06 which should finally resolve the issue.
Until pst-barcode is updated, users who wish to use their existing pst-barcode with the latest version of BWIPP should replace their barcode.pro file with barcode.ps from the monolithic or monolithic-package distribution of BWIPP.
*: An imagemask should be applied as a bitmap stencil mask without "interpolation", unless requested.