Skip to content

Instantly share code, notes, and snippets.

@Songmu
Created December 16, 2010 10:57
Show Gist options
  • Save Songmu/743283 to your computer and use it in GitHub Desktop.
Save Songmu/743283 to your computer and use it in GitHub Desktop.
make barcode
#!/usr/bin/perl
use strict;
use warnings;
use GD::Barcode::NW7;
use Math::CheckDigits;
my $bcd = qq{123432456};
my $cd = Math::CheckDigits->new(
modulus => '10',
weight => [3,1],
);
$bcd = $cd->complete($bcd);
my $gd_barcode = GD::Barcode::NW7->new('A'.$bcd.'A');
open my $fh,'>','barcode.png';
binmode $fh;
print $fh $gd_barcode->plot()->png;
close $fh;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment