46 lines
1 KiB
Bash
Executable file
46 lines
1 KiB
Bash
Executable file
#!/usr/bin/bash
|
|
|
|
pape=$1
|
|
|
|
# get the width of the wallpaper
|
|
height=$(magick identify -format "%h" "$pape")
|
|
width=$(magick identify -format "%w" "$pape")
|
|
|
|
# determine smaller dimension to use for scale
|
|
if [[ "$height" -lt "$width" ]]; then
|
|
scale_val=$height
|
|
else
|
|
scale_val=$width
|
|
fi
|
|
|
|
# calculate appropriate density to scale the svg
|
|
# 25 is the dimension of either side of the svg
|
|
# 50 is the rough scale of the logo that will be on the final image (in %)
|
|
density=$(awk "BEGIN {print ($scale_val/25.0)*50}")
|
|
|
|
# generate a PNG mask from the source svg
|
|
magick \
|
|
-density $density \
|
|
-gravity center \
|
|
arch.svg \
|
|
-background white \
|
|
-extent "${width}x${height}" \
|
|
-resize 100% \
|
|
tmp_arch_mask.png
|
|
|
|
# generate wallpaper name
|
|
outfile_name=$(basename "$pape")
|
|
|
|
# add arch mask to original image
|
|
magick \
|
|
"$pape" \
|
|
-write-mask "tmp_arch_mask.png" \
|
|
-gravity center \
|
|
-blur 0x30 \
|
|
-attenuate 0.3 \
|
|
+noise Laplacian \
|
|
-evaluate Multiply 1.3 \
|
|
"arch_btw_$outfile_name"
|
|
|
|
# delete temporary file
|
|
rm "tmp_arch_mask.png"
|