Skip to content

Instantly share code, notes, and snippets.

@yalab
Created May 3, 2016 07:15
Show Gist options
  • Save yalab/9c9374bd04ac28a25f5ddc97a03f4f44 to your computer and use it in GitHub Desktop.
Save yalab/9c9374bd04ac28a25f5ddc97a03f4f44 to your computer and use it in GitHub Desktop.
#!/bin/bash
FROM="山田_太郎"
POSTAL1="5_4_1"
POSTAL2="0_0_4_4"
ADDR1="大阪市_中央区"
ADDR2="伏見町_4-4-9"
TEL1="06"
TEL2="7878"
TEL3="6838"
TO="吉田_篤"
OUTPUT="output.png"
MATERIAL="material.png"
convert sample.gif $OUTPUT
LABELS=(
"$FROM +110+165 14"
"$POSTAL1 +93+183 20"
"$POSTAL2 +154+183 20"
"$ADDR1 +100+226 14"
"$ADDR2 +100+247 14"
"$TEL1 +110+207 14"
"$TEL2 +150+207 14"
"$TEL3 +180+207 14"
"$TO +110+267 14"
)
for LABEL in "${LABELS[@]}";do
LABEL=($LABEL)
SIZE="${LABEL[2]}"
POSITION="${LABEL[1]}"
LABEL=$(echo ${LABEL[0]} | sed -e 's/_/ /g')
convert \
-fill "#000000" \
-font /Library/Fonts/Osaka.ttf \
-transparent white \
-pointsize "$SIZE" \
label:"$LABEL" \
$MATERIAL
convert $OUTPUT $MATERIAL -geometry $POSITION -composite $OUTPUT
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment