Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including qr-with-logo with all npm packages installed. Try it out:

var qrWithLogo = require("qr-with-logo")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

qr-with-logo v1.0.4

qr-with-logo is a Node package developed to allow for the creation of QR codes with embedded logo images.

Installation

Use node package manager (npm) to install install QRLogo.

npm install --save qr-with-logo

Saving as PNG

const QRLogo = require('qr-with-logo');

const data = JSON.stringify({name: "Zacharie Happel",
              job:  "Student/Intern", 
              grade: "Senior"
})
 
await QRLogo.generateQRWithLogo(data, "logo.png", {}, "PNG", "qrlogo.png") 

Base64

const QRLogo = require('qr-with-logo');

const data = JSON.stringify({name: "Zacharie Happel",
              job:  "Student/Intern", 
              grade: "Senior"
})
 
await QRLogo.generateQRWithLogo(data, "logo.png", {}, "Base64", "qrlogo.png", async function(b64) {
              console.log("Base64: \n" + b64);
}); 

Information

QRLogo currently only supports saving images as PNG and the exportation of Base64 formatted data.

qrcode to facilitate the creation of the QR codes, and the sharp npm package as the means to which images are overlaid.

qrcode options may be included when creating the QR code image:

const opts = {
   errorCorrectionLevel:'H',
   rendererOpts: { quality: 0.3 }
}; 

Example Input/Output:

Logo Image:

Logo

QR Code:

QR

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free