Firstly, I would recommend you export your spreadsheet to some open, non-Microsoft, non-proprietary format, such as a CSV file.
Let's assume it looks like this and is called "names.csv"
:
William, Gates
Kermit, Frog
Now, grab a copy of the indispensable ImageMagick and install it.
Now you need to generate a decent quality badge image rather than the horrible one you linked to. I made mine 1200x760 - so grab this one if you want things to align properly:
Then you will need a script to iterate through the list of names. I am doing it with bash
but you can use Windows for
loop, like here:
#!/bin/bash
counter=1
while IFS=', ' read first last; do
filename="badge-$counter.jpg"
echo Generating file $filename, for $first, $last
magick -font ComicSansMSB -background none -fill magenta -size 420x60 caption:"$first" first.png
magick -font Verdana -background none -fill blue -size 420x60 caption:"$last" last.png
magick badge.png first.png -geometry +710+360 first.png -composite last.png -geometry +710+460 -composite "$filename"
((counter+=1))
done < names.csv
So, for each line in the file, I read the first name and surname. I have a counter that increments for each file (i
) so that I can generate a unique filename.
I then make a little image, sized to match the text field, called "first.png
with the first name. Likewise for the surname, a file called "last.png"
. I do them in different fonts and colours just for fun and so you can see how to do it. I then load up the badge template, and after setting the correct position, composite the names onto the badges and save with unique filenames.
I have marked up an image so you can see where the dimensions come from:
Keywords: ImageMagick, form-filling, form completion, badge, name badge, automated, automatic, scripted, command-line, command line, Excel, CSV.