68a21c46f6
Switch from using `find` to find PNGs to simply accepting a list of files as arguments. Pass long arguments to some compressors. Change-Id: I37884049026fea714d0dd30b08496744c6272379 Reviewed-on: https://code.wireshark.org/review/35646 Reviewed-by: Gerald Combs <gerald@wireshark.org>
47 lines
1.1 KiB
Bash
Executable file
47 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# compress-pngs.sh
|
|
# Run various compression and optimization utilities on one or more PNGs
|
|
#
|
|
# Wireshark - Network traffic analyzer
|
|
# By Gerald Combs <gerald@wireshark.org>
|
|
# Copyright 2013 Gerald Combs
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
#
|
|
|
|
while getopts h OPTCHAR
|
|
do
|
|
case $OPTCHAR in
|
|
h|?)
|
|
echo "Usage: compress-pngs.sh file1.png [file2.png] ..." 1>&1
|
|
exit 0
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Other utilities:
|
|
# PNGOUT (http://advsys.net/ken/utils.htm). Closed source.
|
|
# pngquant (https://pngquant.org/). Lossy.
|
|
|
|
JOBS=8
|
|
PNG_FILES=$(printf "%q " "$@")
|
|
export PNG_FILES
|
|
(
|
|
cat <<"FIN"
|
|
|
|
all: $(PNG_FILES)
|
|
|
|
$(PNG_FILES): FORCE
|
|
@echo Compressing $@
|
|
@hash oxipng 2>/dev/null && oxipng --opt 4 --strip safe "$@"
|
|
@hash optipng 2>/dev/null && optipng -o3 -quiet "$@"
|
|
@hash advpng 2>/dev/null && advpng --recompress --shrink-insane "$@"
|
|
@hash advdef 2>/dev/null && advdef --recompress --shrink-insane "$@"
|
|
@hash pngcrush 2>/dev/null && pngcrush -q -ow -brute -reduce -noforce "$@" pngout.$$$$.png
|
|
|
|
FORCE:
|
|
FIN
|
|
|
|
) | make -j $JOBS -f -
|