Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/compress_images.sh')
-rwxr-xr-xscripts/compress_images.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/compress_images.sh b/scripts/compress_images.sh
new file mode 100755
index 00000000..87993268
--- /dev/null
+++ b/scripts/compress_images.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+TARGET="$1"
+VER="$2"
+PNGQUANT=$(which pngquant)
+PNG="$PNGQUANT -f --skip-if-larger --ext .png --speed 1"
+
+if [ -z "$TARGET" ]; then
+ echo "Usage: $0 <target> <version>"
+ echo "No target provided. Exiting."
+ exit 1
+fi
+
+if [ -z "$VER" ]; then
+ echo "Usage: $0 <target> <version>"
+ echo "No version provided. Exiting."
+ exit 1
+fi
+
+if ! [ -d "$TARGET/$VER" ]; then
+ echo "Target directory $TARGET/$VER does not exist. Exiting."
+ exit 1
+fi
+
+# Compress images
+for image in $(find ${TARGET}/${VER}/ -name "*.png")
+ do $PNG $image
+ echo "Compressing $image"
+done