PagerMaid-Modify/pagermaid/assets/caption.sh
Xtao_dada 265af933e8
🐛 Fix caption permission denied. (#101)
🐛 修复 caption 脚本文件权限错误的问题。
2021-07-04 12:38:41 +08:00

23 lines
440 B
Bash
Executable File

#!/bin/sh -ex
src=$1
dest="result.png"
font=$2
header=$3
footer=$4
width=$(identify -format %w "${src}")
caption_height=$((width/8))
strokewidth=$((width/500))
convert "${src}" \
-background none \
-font "${font}" \
-fill white \
-stroke black \
-strokewidth ${strokewidth} \
-size "${width}"x${caption_height} \
-gravity north caption:"${header}" -composite \
-gravity south caption:"${footer}" -composite \
"${dest}"