summaryrefslogtreecommitdiff
path: root/additions/SW/fancy-qr-codes/overlay-qr.pl
blob: b2cf1c267f9b65374db15b767d9bdad506c122dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env perl 
use strict;
use warnings;
use Data::QRCode;
use Imager::QRCode::Fancy;
use Imager;
 
my ($string,$input_file,$output_file) = @ARGV;
 
my $qr_code = Data::QRCode->new(
    input_data => $string,
    error_correction_level => 'H',
);
 
print "width: ",$qr_code->width,"\n";
 
my $src_img = Imager->new(
    file => $input_file,
or die Imager->errstr;
 
my $img = Imager::QRCode::Fancy::make({
    qr_code => $qr_code,
    image => $src_img,
});
$img->write(file=>$output_file);