summaryrefslogtreecommitdiff
path: root/misc/flag-icons/files/makeflags.sh
diff options
context:
space:
mode:
Diffstat (limited to 'misc/flag-icons/files/makeflags.sh')
-rw-r--r--misc/flag-icons/files/makeflags.sh36
1 files changed, 30 insertions, 6 deletions
diff --git a/misc/flag-icons/files/makeflags.sh b/misc/flag-icons/files/makeflags.sh
index 160212b7c673..b98888fa1546 100644
--- a/misc/flag-icons/files/makeflags.sh
+++ b/misc/flag-icons/files/makeflags.sh
@@ -1,6 +1,26 @@
+# https://commons.wikimedia.org/wiki/File:Flag_of_Esperanto.svg
+add-esperanto-flag()
+{
+ cat > "$1/epo.svg" << EOD
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="$2" height="400">
+<path fill="#FFF" d="m0,0h202v202H0"/>
+<path fill="#090" d="m0,200H200V0H$2V400H0m58-243 41-126 41,126-107-78h133"/>
+</svg>
+EOD
+}
+
+add-missing-flags()
+{
+ add-esperanto-flag 1x1 400
+ add-esperanto-flag 4x3 533
+}
+
+async() { "$@" & }
+
simple()
{
- local comment convert_extra_args destdir height ratio subdir t0 width
+ local comment convert_extra_args destdir flag height i=0 ratio subdir t0 width
comment=$1; convert_extra_args=$2; destdir=$3; shift 3
@@ -12,9 +32,11 @@ simple()
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 \
+ i=$((i % ${JOBS:-1}))
+ test $((i+=1)) -eq 1 && wait
+ async convert -resize ${width}x${height} $convert_extra_args \
"$flag" "$destdir/${width}x${height}/$(basename "$flag" svg)png"
- done
+ done; wait
echo "finished in $(date -ur $((`date +%s`-t0)) +%M:%S)"
done
done
@@ -33,7 +55,7 @@ bordered()
# https://joeldare.com/rounding-image-corners-with-imagemagick
rounded()
{
- local destdir height mask radius ratio subdir t0 width
+ local destdir flag height i=0 mask radius ratio subdir t0 width
destdir=$1; shift
mask=$(mktemp)
@@ -53,11 +75,13 @@ rounded()
echo -n "Generating rounded corner flags ${width}x${height}... "
t0=$(date +%s)
for flag in $subdir/*.svg; do
- convert -resize ${width}x${height} \
+ i=$((i % ${JOBS:-1}))
+ test $((i+=1)) -eq 1 && wait
+ async convert -resize ${width}x${height} \
"$flag" -matte "$mask" \
-compose DstIn -composite -strip \
"$destdir/${width}x${height}/$(basename "$flag" svg)png"
- done
+ done; wait
echo "finished in $(date -ur $((`date +%s`-t0)) +%M:%S)"
done
done