Skip to content

Instantly share code, notes, and snippets.

@shunn
Last active June 19, 2019 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shunn/bf93df4cc342df45db64e05d586605cc to your computer and use it in GitHub Desktop.
Save shunn/bf93df4cc342df45db64e05d586605cc to your computer and use it in GitHub Desktop.
Name Tag Generator Part 1
#!/usr/bin/perl
use strict;
use Image::Magick;
# Input and output files
my $sourcefile = 'image-magick-step-1.jpg'; # blank name tag image (input filename)
my $texturefile = 'image-magick-step-2.jpg'; # pebbled texture image (input filename)
my $targetfile = 'image-magick-step-6.jpg'; # final composite image (output filename)
# Text values
my $name = 'ELDER HEISENBERG'; # text to print on name tag
my $font = 'AltGoth2.ttf'; # font face (TrueType font file)
my $size = 59; # font size
# Starting values for text positioning on blank name tag
my $startx = 252; # horizontal text position (centered)
my $starty = 94; # vertical text position (top edge)
# Shadow offset values
my $offsetx = 0; # horizontal shadow offset
my $offsety = 2; # vertical shadow offset
# Image processing values
my $radius = 0; # blur radius
my $sigma = 1.5; # blur sigma
my $opacity = '70%'; # shadow opacity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment