Skip to content

Instantly share code, notes, and snippets.

@YuukiToriyama
Created May 27, 2019 19:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YuukiToriyama/e2e017c025d89f0baf45c1f7758e79ac to your computer and use it in GitHub Desktop.
Save YuukiToriyama/e2e017c025d89f0baf45c1f7758e79ac to your computer and use it in GitHub Desktop.
またつまらないシェル芸を作ってしまった
#!/bin/bash
convert -size 1500x500 pattern:checkerboard -fill Black -pointsize 400 -font "Symbola" -draw 'text 30,350 "Sh ell 💩"' -write mpr:L -crop 500x500+0+0! -virtual-pixel none -distort Perspective '0,0 100,350 500,0 100,150 0,500 250,400' -write mpr:tmp +delete mpr:L -crop 500x500+500+0! -virtual-pixel none -distort Perspective '0,0 100,150 500,0 250,100 0,500 250,200' mpr:tmp -composite -write mpr:tmp +delete mpr:L -crop 500x500+1000+0! -virtual-pixel none -distort Perspective '0,0 250,200 500,0 400,150 0,500 250,400' mpr:tmp -composite unko.png
@YuukiToriyama
Copy link
Author

実行結果
unko_cube

@YuukiToriyama
Copy link
Author

YuukiToriyama commented Jul 26, 2019

2019/07/27改良版

shellgei

変更点

  • 単純でつまらない投影図法をやめ、一点透視図法に変更しました。
  • 背景を付けました
  • -write mpr:~~オプションを使って一時的なデータを保存するやりかたから、丸括弧を使って表現する方向に切り替えました
    • 前者の場合純粋にワンライナーとして書けているような気がして好きなのですが、かえってややこしそうなのでカッコを使ってネストで書くことにしました。

コード

convert -size 600x600 pattern:CheckerBoard \
     \( -font "IPA-P明朝" -background Snow -gravity Center label:"Sh" -virtual-pixel None -distort Perspective '0,0 100,200 600,0 300,320 0,600 140,400 600,600 300,500' \
     \( label:"ell" -virtual-pixel None -distort Perspective '0,0 300,320 600,0 500,200 0,600 300,500 600,600 460,400' \) -composite \
     \( label:"" -virtual-pixel None -distort Perspective '0,0 100,200 600,0 300,100 0,600 300,320 600,600 500,200' \) -composite \) -composite shellgei.png

資料

座標変換の参考になれば
a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment