Created
February 22, 2021 21:18
-
-
Save bperel/9be18da1215b44c389f2bc3f3fbfe296 to your computer and use it in GitHub Desktop.
Split multi-edge drawing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
image=/var/www/html/DucksManager-old/edges/se/elements/KAP.Fond-169-195.png | |
doubles=(181 188 194) | |
start=169 | |
end=195 | |
width=$(identify -format '%w' $image) | |
height=$(identify -format '%h' $image) | |
crop_size_single=$(echo "scale=3;$width/(${#doubles[@]}+1+$end-$start)" | bc) | |
echo $crop_size_single | |
dir=${image%/*} | |
i=$start | |
crop_x=0 | |
for ((i=start; i<=end; i++)); do | |
echo "Generating $i" | |
# shellcheck disable=SC2199 | |
if [[ ${doubles[@]} =~ ${i} ]]; then | |
crop_size=$(echo "scale=2;$crop_size_single*2" | bc) | |
else | |
crop_size=$crop_size_single | |
fi | |
convert $image -crop "${crop_size}x$height+$crop_x+0" "$dir/KAP.Fond.$i.png" | |
crop_x=$(echo "scale=3;$crop_x+$crop_size" | bc) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment