Skip to contents

First generate a qr_code with a higher ecl level. Then add the logo. The maximum area of logo depends on the difference in ecl level between the version with and without logo. The size of the logo is further restricted by its image ratio. We shrink very wide or tall logos to make sure it still fits on the logo.

Usage

add_logo(
  code,
  logo,
  ecl = c("L", "M", "Q", "H"),
  hjust = c("c", "l", "r"),
  vjust = c("c", "b", "t")
)

Arguments

code

A qr_code object

the path to a logo image file. Must be either png, svg or jpeg format.

ecl

the required error correction level for the QR code after overlaying the logo. Must be lower than the ecl in the code. Defaults to "L". The difference between the ecl set here and the ecl in code determines the maximum area of the logo. For the largest logo, generate code with ecl = "H" and add the logo with ecl = "L".

hjust

Horizontal position of the logo. The default of "c" indicates the centre of the QR code. Use "r" to align the right side of the logo with the right side of the QR code. Use "l" to align the left side of the logo with the right side of the two vertical finder patterns.

vjust

Vertical position of the logo. The default of "c" indicates the centre of the QR code.. Use "b" to align the bottom of the logo with the bottom of the QR code. Use "t" to align the top of the logo with the bottom side of the two horizontal finder patterns.