mirror of
https://github.com/Phantop/dotfiles
synced 2025-01-10 14:17:01 +00:00
bin: blurborder script
This commit is contained in:
parent
903546b22e
commit
b1124a1d16
17
bin/blurborder
Executable file
17
bin/blurborder
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env sh
|
||||
set -e # exit on failure
|
||||
IFS=$(printf '\n\t') # smarter ifs
|
||||
|
||||
test "$RATIOW" || RATIOW=16
|
||||
test "$RATIOH" || RATIOH=9
|
||||
imageh=$(identify -format %h "$1")
|
||||
des_ratio=$(printf '3 k %u %u / p' "$RATIOW" "$RATIOH" | dc)
|
||||
des_width=$(printf '1 k %f %u * p' "$des_ratio" "$imageh" | dc | cut -d. -f1)
|
||||
|
||||
convert "$1" -blur 0x7 -resize "$des_width"x tmp1.ppm
|
||||
convert "$1" -bordercolor black -border 10x0 tmp2.ppm
|
||||
composite -gravity center tmp2.ppm tmp1.ppm tmp3.ppm
|
||||
mogrify -gravity center -crop "x$imageh+0" tmp3.ppm
|
||||
outfile="$(dirname "$1")/tran_$(basename "$1" | tuc -d. -f:-2).jxl"
|
||||
cjxl -e 8 tmp3.ppm "$outfile"
|
||||
rm tmp*.ppm
|
Loading…
Reference in a new issue