Helpers to compress PNG images
#!/bin/bash | |
DIR=$(dirname "$0") | |
# TODO: probably only works on macOS | |
CPUS=$(sysctl -n hw.ncpu) | |
PROCS=$((CPUS / 2)) # run half as many tasks as CPUs | |
if [[ "$PROCS" == "0" ]]; then | |
PROCS="1" | |
fi | |
echo "Using $PROCS tasks..." | |
printf '%s\0' "${@}" | xargs -0 -P $PROCS -n 1 -I % bash -c "${DIR}/crush \"%\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment