Skip to content

Instantly share code, notes, and snippets.

@Azzawie
Last active October 6, 2020 14:19
Show Gist options
  • Save Azzawie/fac4e5aac8c0241964ddd4718b9b2dd2 to your computer and use it in GitHub Desktop.
Save Azzawie/fac4e5aac8c0241964ddd4718b9b2dd2 to your computer and use it in GitHub Desktop.
QRCODE
  • How to generate a QR code with ruby script
require 'rqrcode'

# qrcode = RQRCode::QRCode.new("mailto:<mwmaki2@gmail.com>?query")
qrcode = RQRCode::QRCode.new("")

png = qrcode.as_png(
  bit_depth: 1,
  border_modules: 4,
  # color_mode: ChunkyPNG::COLOR_GRAYSCALE,
  color_mode: ChunkyPNG::Color.rgba(100, 0,0, 128),
  color: 'black',
  file: nil,
  fill: 'white',
  module_px_size: 16,
  resize_exactly_to: true,
  resize_gte_to: true,
  size: 360
)

IO.write("/Users/mustafa.azzawie/desktop/github-qrcode1.png", png.to_s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment