Transcoding is really from any image format

This commit is contained in:
David Heinemeier Hansson 2025-08-14 21:04:38 +02:00
parent bf49a86e98
commit 2847ed270f

View File

@ -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 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 any image to JPG image that's great for shrinking wallpapers
transcode-png2jpg() { img2jpg() {
magick $1 -quality 95 -strip ${1%.*}.jpg magick $1 -quality 95 -strip ${1%.*}.jpg
} }
# Transcode PNG to JPG image that's great for sharing online without being too big # Transcode any image to JPG image that's great for sharing online without being too big
transcode-png2jpg-1080() { img2jpg-small() {
magick $1 -resize 1080x\> -quality 95 -strip ${1%.*}.jpg 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"
}