#!/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);
