mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Allow optional arguments to img transcoding functions and prevent overwrites
This commit is contained in:
@@ -55,19 +55,28 @@ transcode-video-4K() {
|
|||||||
|
|
||||||
# Transcode any image to JPG image that's great for shrinking wallpapers
|
# Transcode any image to JPG image that's great for shrinking wallpapers
|
||||||
img2jpg() {
|
img2jpg() {
|
||||||
magick $1 -quality 95 -strip ${1%.*}.jpg
|
img="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
magick "$img" $@ -quality 95 -strip ${img%.*}-optimized.jpg
|
||||||
}
|
}
|
||||||
|
|
||||||
# Transcode any image 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
|
||||||
img2jpg-small() {
|
img2jpg-small() {
|
||||||
magick $1 -resize 1080x\> -quality 95 -strip ${1%.*}.jpg
|
img="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
magick "$img" $@ -resize 1080x\> -quality 95 -strip ${img%.*}-optimized.jpg
|
||||||
}
|
}
|
||||||
|
|
||||||
# Transcode any image to compressed-but-lossless PNG
|
# Transcode any image to compressed-but-lossless PNG
|
||||||
img2png() {
|
img2png() {
|
||||||
magick "$1" -strip -define png:compression-filter=5 \
|
img="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
magick "$img" $@ -strip -define png:compression-filter=5 \
|
||||||
-define png:compression-level=9 \
|
-define png:compression-level=9 \
|
||||||
-define png:compression-strategy=1 \
|
-define png:compression-strategy=1 \
|
||||||
-define png:exclude-chunk=all \
|
-define png:exclude-chunk=all \
|
||||||
"${1%.*}.png"
|
"${img%.*}-optimized.png"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user