diff --git a/default/bash/functions b/default/bash/functions index 538f607f..d184e50a 100644 --- a/default/bash/functions +++ b/default/bash/functions @@ -46,12 +46,22 @@ transcode-video-4K() { ffmpeg -i $1 -c:v libx265 -preset slow -crf 24 -c:a aac -b:a 192k ${1%.*}-optimized.mp4 } -# Transcode PNG to JPG image that's great for shrinking wallpapers -transcode-png2jpg() { +# Transcode any image to JPG image that's great for shrinking wallpapers +img2jpg() { magick $1 -quality 95 -strip ${1%.*}.jpg } -# Transcode PNG to JPG image that's great for sharing online without being too big -transcode-png2jpg-1080() { +# Transcode any image to JPG image that's great for sharing online without being too big +img2jpg-small() { magick $1 -resize 1080x\> -quality 95 -strip ${1%.*}.jpg } + +# Transcode any image to compressed-but-lossless PNG +img2png() { + magick "$1" -strip -define png:compression-filter=5 \ + -define png:compression-level=9 \ + -define png:compression-strategy=1 \ + -define png:exclude-chunk=all \ + "${1%.*}.png" +} +