Scaling QR Codes (and other Pixel Art) in Photoshop

If you’ve seen the preview videos, then you’ll now that in InDesign CC (otherwise known as CS7) we will be able to generate our own QR Codes right in InDesign. And of course there are many QR code generators available on the Internet. But this article will still be relevant for some workflows, so I’ve decided to write it up.

I was recently presented with a project involving many pre-supplied QR code images. Unfortunately the images did not meet resolution requirements. Rather than having to recreate all the images, I was hoping to be able to simply resize them somehow. I eventually figured out the trick to scaling these images in Photoshop so that they would retain their sharp edges; the same trick is used by pixel artists to retain the sharp edges of their pixel artwork. After all, a QR code is basically a pixel map, using very large pixels.

The idea is to resize the image using Photoshop’s Nearest Neighbor algorithm, which preserves hard edges. However, this is not quite enough, just by itself. It is also necessary to scale the image by exactly twice its original size, or three times, or four, etc. This is so that Photoshop can calculate exact blocks of pixels, rather than having to approximate groupings.  This not only works for QR codes, but for any image for which you wish to preserve the exact pattern of pixels.

A small QR code resized in Photoshop to exactly twice its original size using the Nearest Neighbor algorithm perfectly preserves its crisp edges.

A small QR code resized in Photoshop to exactly twice its original size using the Nearest Neighbor algorithm perfectly preserves its crisp edges.

Steps:

  1. Open the desired image in Photoshop.
  2. Go to Image: Resize.
  3. Ensure that “Constrain Proportions” and “Resample Image” are turned on.
  4. At the bottom of the window is a dropdown box. Choose “Nearest Neighbor (preserve hard edges).”
  5. Set the width to exactly twice (or 3x, 4x, etc.) what it is currently. Use a calculator if necessary.
  6. Click OK.

NOTE: This method works great for flattened images with no layer styles, effects, layer blending, smart objects, etc. More complex images with these features may not work quite as expected. If the image does not appear to scale perfectly, save a flattened copy and work with that instead.

Taking it to the next level: Do you have a large number of these images? Consider recording the process above as an action and running a batch process on all the QR code images. And because actions store changes in image size as percentages, You’ll be able to play the action back on images of different sizes safely!

Does the resolution really matter? This is an interesting question—or it is if you’re a bit of a geek (like me). If you think about it, resolution only matters if you’re worried about seeing the pixels. What happens if you stretch a pixel image too much in InDesign? You start to see the pixels. But what is a QR code made of? Square blocks of pixels. You actually WANT to see them. Is it ever going to look any worse, no matter how much you stretch it? NO. So really, the resolution of a QR code doesn’t effect its print quality, as long as it hasn’t been resized using some sort of blurring algorithm (a big no-no). In fact, resolution is irrelevant if you’re working with pixel art—that is, artwork in which you’re intentionally showing pixels. And we’ve already discussed how QR codes are similar to pixel art. People love to have pixellated Mario on their t-shirts, just like they like to have QR codes on their advertisements. The goal is not to hide the pixels, but to show them in all their squarish glory. However, those low-res QR codes are sure to give the prepress people fits. So for no other reason, that’s why you might want to fix the resolution of your QR codes. It will also be less of a distraction to you, if you use your InDesign realtime preflight, so that you can focus on real image resolution problems and not be distracted by a bunch of QR codes that, while they might print fine, are easy enough to fix.

,

No comments yet.

Leave a Reply