Skip to content

Instantly share code, notes, and snippets.

@kana
Last active September 16, 2020 17:25
Show Gist options
  • Save kana/ed7b29ed8c8e9e3b19201c192f40f4d1 to your computer and use it in GitHub Desktop.
Save kana/ed7b29ed8c8e9e3b19201c192f40f4d1 to your computer and use it in GitHub Desktop.
font=~/Library/Fonts/MyFavoriteFont.ttf
icon=apple-touch-icon.png
convert \
-background transparent \
-size 980x640 \
\( \
-background transparent -fill white \
-font "$font" \
-gravity center \
'label:Hatokurandom' \
\) \
,text.png
convert ,text.png -alpha extract ,mask.png
convert \
,mask.png \
-fill black -draw "polygon 641,0 381,640 980,640 980,0" \
,mask-for-left.png
convert \
,mask.png \
-fill black -draw "polygon 0,0 640,0 380,640 0,640" \
-fill black -draw "polygon 537,0 537,640 980,640 980,0" \
,mask-for-center.png
convert \
,mask.png \
-fill black -draw "polygon 0,0 537,0 537,640 0,640" \
,mask-for-right.png
convert ,text.png ,mask-for-left.png \
-alpha off -compose CopyOpacity -composite \
,text-left.png
convert ,text.png ,mask-for-center.png \
-alpha off -compose CopyOpacity -composite \
,text-center.png
convert ,text.png ,mask-for-right.png \
-alpha off -compose CopyOpacity -composite \
,text-right.png
convert \
-background transparent \
\( ,text-left.png -gravity center -extent 980x640-0+0 \) \
\( ,text-center.png -gravity center -extent 980x640+0-8 \) \
-composite \
\( ,text-right.png -gravity center -extent 980x640+0-0 \) \
-composite ,text-glitched.png
convert \
-background transparent \
\( "$icon" -gravity center -resize '1280x640^' -extent 1280x640 -blur 0x20 -fill black -colorize 25% \) \
\( ,text-glitched.png -gravity east -extent 1280x640-80+0 \) \
-composite \
\( "$icon" -gravity west -extent "1280x640-80+0" \) \
-composite ,ogp.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment