Image::QRCode::Effects - Create snazzy QRCodes.
use Image::QRCode::Effects; my $image = Image::QRCode::Effects->new( level => 'H', plot => 'just another perl hacker', ); $image->write( outfile => 'qrcode.jpg', colour => '#1500ff', inner_shadow => 1, round_corners => 1, gradient => 1, gradient_colour => '#ffa200', gradient_type => 'radial', );
This module provides a collection of effects commonly used on QRCodes to make them look interesting.
It's designed for use with Imager::QRCode, although it'll likely work with any barcode images. Providing you don't stray too far from the default parameters, the resulting barcode should be easily readable.
# Takes same arguments as Imager::QRCode, and additional 'plot' text my $qrcode = Imager::QRCode->new( plot => 'Fire walk with me', size => 2, margin => 2, version => 1, level => 'M', casesensitive => 1, lightcolor => Imager::Color->new( 255, 255, 255 ), darkcolor => Imager::Color->new( 0, 0, 0 ), ); # Or from file my $qr = Image::QRCode::Effects->new( infile => '/path/to/barcode.jpg' ); # Or from Imager object (eg. Imager::QRCode, after calling ->plot) my $qr = Image::QRCode::Effects->new( qrcode => $qrcode );
Returns an Image::QRCode::Effects object, ready to call "write". For the parameters to Imager::QRCode, see that module's documentation.
Image::QRCode::Effects
$qrcode->write( outfile => '/my/new/barcode.jpg', # dimensions size => '600x600', # optional, default is '600x600' # basic fill colour colour => '#00ff00', # default #000000 # extra fill effects gradient => 1, # optional, default 0 gradient_colour => '#ff0000', gradient_type => 'normal', # normal|radial|plasma # effects # wave effect wave => 1, # optional, default 0 wavelength => 30, amplitude => 1.5, # inner shadow effect inner_shadow => 1, # optional, default 0 shadow_colour => '#cccccc', # default #000000 # rounded corners effect round_corners => 1, # optional, default 0 corner_sigma => 2.2, corner_threshold => '42%,58%', );
Writes the barcode with effects to the specified outfile.
outfile
There are three main effects: a wave-like effect, rounded corners and an inner shadow. In addition, there are several gradient fill options. These can be combined and each have parameters that can be altered to create unique images.
Parameters:
size
colour
gradient
gradient_colour
gradient = 1
gradient_type
normal
radial
plasma
wave
wavelength
wave = 1
amplitude
inner_shadow
shadow_colour
inner_shadow = 1
round_corners
corner_sigma
round_corners = 1
corner_threshold
Imager::QRCode
Image::Magick
Mike Cartmell, <mcartmell at cpan.org>
<mcartmell at cpan.org>
Copyright (C) 2013 Mike Cartmell
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/ for more information.
To install Image::QRCode::Effects, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::QRCode::Effects
CPAN shell
perl -MCPAN -e shell install Image::QRCode::Effects
For more information on module installation, please visit the detailed CPAN module installation guide.