Skip to content

Instantly share code, notes, and snippets.

@mattintosh4
Last active December 19, 2015 05:05
Show Gist options
  • Save mattintosh4/ee0cbbfb5fdff44ff5ed to your computer and use it in GitHub Desktop.
Save mattintosh4/ee0cbbfb5fdff44ff5ed to your computer and use it in GitHub Desktop.
艦これ一覧めーかーカッコカリ
#!/bin/sh
set -e
# watermark font
font="Noto-Sans-CJK-JP-Bold"
# watermark color
color="#0004"
# arguments process
while :
do
case ${1} in
-c) # column number
column=${2}
shift
;;
-m) # enable watermark
watermark=
;;
*)
break
;;
esac
shift
done
img1=${1} img2=${2} img3=${3} img4=${4} img5=${5} img6=${6}
w=486 h=372 x=314 y=96
set -- -crop ${w}x${h}+${x}+${y}\!
case ${watermark+set} in
set)
set -- "${@}" \
-gravity Center \
-fill none -stroke ${color} -strokewidth 1 -draw "circle $((${w}/2)),$((${h}/2)) $((${w}/2+32)),$((${h}/2))" \
-fill ${color} -stroke none -font ${font} -pointsize 48 -annotate 0
;;
esac
convert -verbose "${img1}" "${@}" ${watermark+壹} miff:- | ( \
convert -verbose "${img2}" "${@}" ${watermark+貳} miff:- | ( \
convert -verbose "${img3}" "${@}" ${watermark+參} miff:- | ( \
convert -verbose "${img4}" "${@}" ${watermark+肆} miff:- | ( \
convert -verbose "${img5}" "${@}" ${watermark+伍} miff:- | ( \
convert -verbose "${img6}" "${@}" ${watermark+陸} miff:- | ( \
montage -tile ${column:-2}x -resize 100% -geometry +0+0 fd:3 fd:4 fd:5 fd:6 fd:7 fd:8 unit.png ) 8<&0 ) 7<&0 ) 6<&0 ) 5<&0 ) 4<&0 ) 3<&0
#!/bin/sh
set -e
# Crop position
w=486 h=372 x=314 y=96
# Background color
bg="gradient:SkyBlue-Gray40"
# Background compose mode. e.g.) "None", "Modulate", "Blend"
bg_compose="Modulate"
# Background plasma color
bg_plasma="#aaa-#999"
# Background blur
bg_blur="-motion-blur"
bg_blur_geometry="0x25+90"
# Perspective level
p=30
perspective="
0,0,$((${p}*3)),${p}
${w},0,${w},0
${w},$((${h}*2)),${w},$((${h}*2))
0,${h},$((${p}*3)),$((${h}-${p}))
"
func(){
convert "${1}" -alpha on -crop ${w}x${h}+${x}+${y}\! \( -size ${w}x${h} xc:none -draw "polygon 20,0 ${w},0 ${w},${h} 20,${h} 0,$((${h}-20)) 0,20" -negate \) -compose CopyOpacity -composite miff:- \
| convert fd:0 \( +clone -flip \( +clone -alpha Extract \) -size ${w}x$((${h}/2)) gradient:gray50-gray0 +swap -compose CopyOpacity -composite \) -append miff:- \
| convert fd:0 -virtual-pixel transparent -distort Perspective "${perspective}" -trim +repage -bordercolor none -border 10 miff:-
}
func "${1}" | ( \
func "${2}" | ( \
func "${3}" | ( \
func "${4}" | ( \
func "${5}" | ( \
func "${6}" | ( \
montage -verbose -tile 6x -resize 100% -geometry +0+0 fd:3 fd:4 fd:5 fd:6 fd:7 fd:8 -background none miff:- \
| convert -verbose \
fd:0 -bordercolor none -border 10x0 -filter Lanczos2Sharp -resize 1500x \
\( \
\( -size 1500x500 ${bg} -size 1500x500 plasma:${bg_plasma} ${bg_blur} ${bg_blur_geometry} -compose ${bg_compose} -composite \) \
\( -size 30x500 xc:#0808 -size 30x500 xc:#8008 +append -background none -shear 19x0 \) \
-gravity Center -geometry +0+0 -compose Over -composite \
\) \
+swap -compose Over -composite -layers Mosaic \
-font Boycott-Regular -gravity Center \
-fill \#fffffff80 -pointsize 48 -annotate +0+100 "Combined Fleet Girls Collection" \
-fill \#fffffff80 -pointsize 16 -kerning 10 -annotate +0+140 "Kantai Collection -KanColle-" \
out.png ) 8<&0 ) 7<&0 ) 6<&0 ) 5<&0 ) 4<&0 ) 3<&0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment