Skip to content

Instantly share code, notes, and snippets.

View javabean's full-sized avatar

Cédrik javabean

View GitHub Profile
@javabean
javabean / image-best-format.sh
Created July 27, 2024 21:10
image-best-format.sh
#!/bin/sh
# shellcheck disable=SC3043
set -e
set -u
#(set -o | grep -q pipefail) && set -o pipefail
#(set -o | grep -q posix) && set -o posix
#shopt -s failglob
#set -x
# Compute the most optimal (file size) format for an input image
#!/bin/sh
set -eu
# requires jpeg-recompress <https://github.com/danielgtaylor/jpeg-archive>
# same as jpeg-archive, but:
# * without 3rd-party dependencies
# * can re-compress a single file as well as a directory
# * replaces original with optimized version (keeping file timestamps)
# * no support for RAW images