Skip to content

Instantly share code, notes, and snippets.

@shunn
Created June 19, 2019 13:58
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/68ae0c2d3d43993a3812e519a9a7aab4 to your computer and use it in GitHub Desktop.
Save shunn/68ae0c2d3d43993a3812e519a9a7aab4 to your computer and use it in GitHub Desktop.
Name Tag Generator Part 5
# Create a mask (or stencil) image using the desired text
my $mask = Image::Magick->new; # Create a new image object
$mask->Set( size => '503x339' ); # Same size as blank name tag image
$mask->ReadImage( 'canvas:black' ); # Fill the image with black
$mask->Annotate( # Render the text on the image in white
font => $font,
pointsize => $size,
fill => 'white',
text => $name,
x => $x,
y => $y,
antialias => true,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment