[feature] cover function support gravity
This commit is contained in:
parent
7358f7588e
commit
65380a36fa
16
bin/sc
16
bin/sc
|
@ -132,19 +132,21 @@ function togif -a infile outfile
|
||||||
end
|
end
|
||||||
|
|
||||||
set --append subcmds cover
|
set --append subcmds cover
|
||||||
set cover_help '<infile> <text> [outfile=cover.png]' 'add text to infile(image) and output a cover'
|
set cover_help '<infile> <text> [gravity=center] [outfile=cover.png]' 'add text to infile(image) and output a cover'
|
||||||
function cover -a infile text outfile
|
function cover -a infile text gravity outfile
|
||||||
not set -q outfile || set outfile 'cover.png'
|
set x 50
|
||||||
magick convert $infile -thumbnail 1146x -background black -gravity center -extent 1146x717 resized.png
|
test -z $outfile && set outfile 'cover.png'
|
||||||
|
test -z $gravity && set gravity 'center' && set x 0 && set y 0
|
||||||
|
magick convert $infile -thumbnail 1146x -background black -gravity $gravity -extent 1146x717 resized.png
|
||||||
magick convert resized.png \
|
magick convert resized.png \
|
||||||
-gravity center \
|
-gravity $gravity \
|
||||||
-fill black \
|
-fill black \
|
||||||
-pointsize 120 -font 'WenQuanYi-Micro-Hei' \
|
-pointsize 120 -font 'WenQuanYi-Micro-Hei' \
|
||||||
-interline-spacing 20 \
|
-interline-spacing 20 \
|
||||||
-stroke '#e1e1e1' -strokewidth 40 \
|
-stroke '#e1e1e1' -strokewidth 40 \
|
||||||
-annotate +0+0 "$text" \
|
-annotate +$x+0 "$text" \
|
||||||
-stroke '#000000' -strokewidth 5 \
|
-stroke '#000000' -strokewidth 5 \
|
||||||
-annotate +0+0 "$text"\
|
-annotate +$x+0 "$text"\
|
||||||
$outfile
|
$outfile
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user