Wallet-sized Ontario COVID Vaccination Certificate

The province of Ontario is now issuing COVID vaccinations certificates with QR codes on them, which you can carry with you to obtain admission to various public gathering places. You can also show the certificate on your phone, but having it on paper is useful in various circumstances:

  • You don’t own a phone
  • You don’t have your phone with you
  • The phone’s battery is dead
  • Pulling out a wallet card along with your photo ID is faster than pulling up the certificate on your phone and pulling out photo ID anyway

Unfortunately, none of the sharp minds at our provincial government have realized that if someone wants to carry around a paper certificate, it would be much easier if it were wallet-sized rather than a full letter-size sheet of paper. Not to mention that the QR code is placed point blank on a fold in the paper, likely making the code unreadable, for pretty much any normal way of folding the paper.

I have made a wallet-sized version (3.56×2.24″ or 9.05×5.69cm) of my certificate. The front contains all the information of the original certificate except the QR code, with piles of white space removed, and the QR code is on the back. The actual text on the front is half the size of the original text and is still easily readable, and the QR code is about the same size as it would appear on the screen of a phone. All that is missing is the “page 1 of 2” annotation and, of course, page 2 which contains no useful information whatsoever.

Since we have 3 in our family, I decided to automate the slicing and dicing operation that generates the front and back images. I am using an image-processing tool called ImageMagick to do this, along with the following script that contains all the slicing operations.

 -units PixelsPerInch
 ( +clone
  -crop 1419x1419+536+1828
  -threshold 50%
  -resize 2425x2425
  -gravity center -extent 4274x2688
  -density 1200x1200
  -write back.png
 )
 -delete 1
 -gravity NorthWest
 ( +clone -crop +0+6270 -repage +0+6120 ) -flatten
 ( +clone -crop +0+5875 -repage +0+5800 ) -flatten
 ( +clone -crop +0+5500 -repage +0+4625 ) -flatten
 ( +clone -crop +0+4200 -repage +0+4075 ) -flatten
 ( +clone -crop +0+3680 -repage +0+3630 ) -flatten
 ( +clone -crop +0+3580 -repage +0+3530 ) -flatten
 ( +clone -crop +0+3380 -repage +0+1540 ) -flatten
 ( +clone -crop +0+660 -repage +0+575 ) -flatten
 ( +clone -crop +0+430 -repage +0+345 ) -flatten
 ( +clone -crop +0+288 -repage +0+0 ) -flatten
 ( +clone -crop +4785+0 -repage +4660+0 ) -flatten
 ( +clone -crop +460+0 -repage +335+0 ) -flatten
 ( +clone -crop +288+0 -repage +0+0 ) -flatten
 -crop 4274x2688+0+0 +repage -density 1200x1200
 -write front.png

I’m not claiming this is the most efficient script to do this; in particular, cutting out all the slices and flattening them all at once would likely be faster than doing a cut-and-flatten for each strip to slice away.

To make a wallet card, the steps are as follows:

  1. Download and install ImageMagick
  2. Save the above script to a file
  3. Open the PDF certificate file in a PDF viewer.
  4. Extract/export the first page of the certificate as a 600×600DPI image file, which should be 5100×6600 pixels since the page size is 8½×11″. Use an uncompressed, non-lossy image format like PNG.
  5. In a command/shell window, run the command:
    magick imageFile -script scriptFile
    

    where magick is the name of the command installed with ImageMagick, imageFile is the name of the image saved in step 4, and scriptfile is the name of the script file saved in step 2.

  6. The script will create files front.png and back.png in your current folder.
  7. Print these back-to-back on heavy paper, cut out, and laminate if desired. You have to make sure the program you use to print the image files prints at 100% zoom, and that the two images actually end up back-to-back. I found that specifying that the image should be centered, and running the same sheet through the printer twice (once for each image), flipped over the second time, worked well. You could also print on separate sheets and glue them back-to-back.
  8. For more certificates, repeat steps 3-7.

That leaves a bunch of details for you to figure out, like how you export an image from your PDF viewer, making sure the ‘magick’ command is in your command search path, figuring how this all maps to a Unix or Mac system (I was using Windows), doing this all in a separate new folder to make cleaning up easy, etc…

Update!

This original script I posted here didn’t work in general because the directives in the script were made to work only for 97×97 codes (what I found in my own certificate) but not all the QR codes are 97×97 bits. I have found that my daughter’s code is 93×93, and although my wife’s is 97×97 my phone’s QR code reader couldn’t scan it at all. The latter was an unrelated problem having to do with the resize operation I was using trying to do smoothing as it worked, leading to some pixels in the resize code being wrong.

But the script as posted above now works on 3 out of 3 certificates that it has been tested on.

Leave a Reply

Your email address will not be published. Required fields are marked *

*