diff options
Diffstat (limited to 'misc/flag-icons/files/makeflags.sh')
-rw-r--r-- | misc/flag-icons/files/makeflags.sh | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/misc/flag-icons/files/makeflags.sh b/misc/flag-icons/files/makeflags.sh index ea16f8edd252..160212b7c673 100644 --- a/misc/flag-icons/files/makeflags.sh +++ b/misc/flag-icons/files/makeflags.sh @@ -1,5 +1,37 @@ +simple() +{ + local comment convert_extra_args destdir height ratio subdir t0 width + + comment=$1; convert_extra_args=$2; destdir=$3; shift 3 + + for subdir in ?x?; do + ratio=${subdir%x*}/${subdir#*x} + for height; do + width=$((height * $ratio)) + mkdir -p "$destdir/${width}x${height}" + echo -n "Generating $comment flags ${width}x${height}... " + t0=$(date +%s) + for flag in $subdir/*.svg; do + convert -resize ${width}x${height} $convert_extra_args \ + "$flag" "$destdir/${width}x${height}/$(basename "$flag" svg)png" + done + echo "finished in $(date -ur $((`date +%s`-t0)) +%M:%S)" + done + done +} + +plain() +{ + simple undecorated -strip "$@" +} + +bordered() +{ + simple black-bordered '-shave 1x1 -bordercolor black -border 1 -strip' "$@" +} + # https://joeldare.com/rounding-image-corners-with-imagemagick -rounded_corners() +rounded() { local destdir height mask radius ratio subdir t0 width @@ -18,7 +50,7 @@ rounded_corners() mkdir -p "$destdir/${width}x${height}" - echo -n "Generating flags ${width}x${height}... " + echo -n "Generating rounded corner flags ${width}x${height}... " t0=$(date +%s) for flag in $subdir/*.svg; do convert -resize ${width}x${height} \ |