Imager::QRCode(3pm)

πŸ‘‘ Imager::QRCode β€” the whole vibe

okay bestie, listen. Imager::QRCode is a Perl module that generates QR Codes with Imager, powered by libqrencode. It lives in the User Contributed Perl Documentation section of your man pages, and it is genuinely so easy it's giving main character energy. ✨


🌸 NAME 🌸

Imager::QRCode β€” Generate QR Code with Imager using libqrencode πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

Like. Look at this. It's so clean:

use Imager::QRCode;

my $qrcode = Imager::QRCode->new(
    size          => 2,
    margin        => 2,
    version       => 1,
    level         => 'M',
    casesensitive => 1,
    lightcolor    => Imager::Color->new(255, 255, 255),
    darkcolor     => Imager::Color->new(0, 0, 0),
);
my $img = $qrcode->plot("blah blah");
$img->write(file => "qrcode.gif")
  or die "Failed to write: " . $img->errstr;

# or exporting function
use Imager::QRCode qw(plot_qrcode);

my $img = plot_qrcode("blah blah", \%params);
$img->write(file => "qrcode.gif")
  or die "Failed to write: " . $img->errstr;

Two whole paths to the same slay: object-oriented new + plot, or the exported plot_qrcode function. Pick your fighter. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

This module lets you generate QR Code with Imager. No cap. It uses libqrencode version 2.0.0 and above β€” so make sure your libqrencode is at least that, bestie, or it's not gonna go. 🫢


✨ METHODS ✨

new

$qrcode = Imager::QRCode->new(%params);

The new() constructor method instantiates a brand new Imager::QRCode object, periodt. new() accepts these parameters:

  • "size" β€” Horizontal and vertical size of module(dot). Default is 4. πŸ“
  • "margin" β€” Margin size of QR Code. Default is 3. 🌬️
  • "level" β€” Error correction level. Valid values are 'M', 'L', 'Q' or 'H'. Default is 'L'. πŸ›‘οΈ
  • "version" β€” Version of the symbol. If specify '0', this module chooses the minimum version for the input data. Default is '0'. πŸ”’
  • "mode" β€” Encoding mode. Valid values are 'numerical', 'alpha-numerical', '8-bit' or 'kanji'. Default is '8-bit'. 🧬

If not give "casesensitive" then should be given "mode". If 'kanji' is given, characters will be encoded as Shift-JIS characters. If '8-bit' is given, all of non-alpha-numerical characters will be encoded as is. If you want to embed UTF-8 string, choose '8-bit'. 🈢

  • "casesensitive" β€” If your application is case-sensitive using 8-bit characters, set to '1'. Default is '0'. πŸ” 
fr fr, that mode/casesensitive relationship is the one thing people trip on, so read it twice πŸ’€

plot($text)

$img = $qrcode->plot("blah blah");

Create a new QR Code image. This method returns an Imager object plotted QR Code with the given text. That's it, that's the method. Iconic. 🌈


πŸ’– EXPORTABLE FUNCTION πŸ’–

plot_qrcode($text, \%params)

$text is input text. %params is same parameter as new().

$text is input text. %params is same parameter as new(). Yes bestie, same params β€” so everything you learned up there still applies. πŸ“


πŸ‘€ SEE ALSO πŸ‘€


🌟 AUTHOR 🌟

Yoshiki KURIHARA "<kurihara __at__ cpan.org>" πŸ’œ


πŸ’ THANKS πŸ’

Tokuhiro Matsuno 🫢


Copyright (c) 2011, Yoshiki KURIHARA "<kurihara __at__ cpan.org>".

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. ✨


okay that's the whole page, bestie, go generate some QR codes πŸ’…

Sign-off vibes: this page is from perl v5.42.3, dated 2026-08-20, and it's the Imager::QRCode(3pm) page. Byeee πŸŽ€πŸ¦‹
πŸ“¦ where this page comes from