This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Licensed under the Zero-Clause BSD terms: https://opensource.org/license/0bsd | |
# Requires `imagemagick` and `cavif`. | |
## Arguments | |
# 1: /path/to/input | |
# 2: /path/to/output (optional, default output: 'input_no_ext'-'quality'.avif) | |
# 3: Target SSIM value (default value: 96%) | |
# Since the SSIM score is output as a 6 decimal place number (e.g. 0.960000), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Licensed under the Zero-Clause BSD terms: https://opensource.org/license/0bsd | |
# Requires imagemagick, and optionally pngquant & optipng | |
# | |
# Argument 1: Number of pixels to fill, required. | |
# Argument 2: Height ratio, default 23. | |
# Argument 3: Width ratio, default 5. | |
pquit() { printf "\033[1m\033[31m%b\033[0;39m" "$1"; exit 1; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Explanation | |
PNGQuant: `pngquant --quality 100-100 --speed 1 --strip` | |
OxiPNG: `oxipng --opt max --strip all --alpha` | |
OxiPNG-ZF: `oxipng --opt max --strip all --alpha --zopfli` | |
Oxi-Quant: "PNGQuant" > "OxiPNG" (non-ZF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Licensed under the Zero-Clause BSD terms: https://opensource.org/license/0bsd | |
# Requires pngquant, oxipng, gifsicle, gif2apng, libwebp, and optionally perl-image-exiftool. | |
perr() { printf "\033[1m\033[31m%b\033[0;39m" "$1"; } | |
pquit() { perr "$1"; exit 1; } | |
pstat() { printf "\033[1m\033[34m%b\033[0;39m\033[1m%b\033[0;39m\n" "$1" "$2"; } | |
clean() { if ! rm -r "$tmp"; then pquit "Failed to delete '$tmp'!\n"; fi } |