1

This is a bit of an odd question, but basically I'm trying to create a set of Pictionary cards for a game. To do this, I have a list of 1500 nouns separated by newlines and I need each of them to be placed on individual PNG files of a specific resolution. Is there an easy way of doing this?

  • Do you have any design software available (or preferred) such as Photoshop, Illustrator, or InDesign? – JohnB Sep 28 '15 at 22:48
  • @JohnB Just paint.net, nothing that costs money – quadrplax Sep 28 '15 at 23:28
  • GIMP supports scripting... – Yorik Sep 29 '15 at 20:56
4

This is a simple task for ImageMagick. The caption tool allows for word wrapping, though if it's just nouns then that might not be a concern. An example command would look like this:

convert -background black -fill white -pointsize 32 \
        -size 500x300 -gravity center caption:'WORD' WORD.png

Here's the resulting PNG:

enter image description here

Then all you need is a script to input your words file and feed them in to that command. Here's how to do it with bash:

#!/bin/bash
while IFS='' read -r line || [[ -n "$line" ]]; do
    convert -background black -fill white -pointsize 32 \
            -size 500x300 -gravity center caption:$line $line.png
done < "$1"

Usage would be ./scriptname words-file.txt

  • +1 WORST CASE, without bash, the OP can find and replace on newline using notepad++ to emit a 1500 line bat file (not recommended) – Yorik Sep 29 '15 at 20:58
  • This works. FYI, for future readers, this can be done in widows like this: FOR /F %%i IN (words.txt) DO convert -background white -fill black -pointsize 60 -size 582x408 -gravity center caption:%%i %%i.png – quadrplax Sep 30 '15 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.