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

compress_images.sh « scripts - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 87993268ac80451f791f69d82d71b0118e57aacb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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