aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-03-16 06:11:03 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-03-16 06:11:03 +0300
commit58cf909f803dca60cee6b668fc60413aa3617014 (patch)
tree0bdd232602bfca21b42a9a40ae0e178b0b19d30b
parent311d014fe07199b0c734a52877e114b6b1ff64c9 (diff)
downloadswayrice-58cf909f803dca60cee6b668fc60413aa3617014.tar.gz
swayrice-58cf909f803dca60cee6b668fc60413aa3617014.zip
imgres script
Improved optimization of jpegs, especially for the recipe section of my site.
-rwxr-xr-xdotfiles/.local/bin/imgres16
1 files changed, 11 insertions, 5 deletions
diff --git a/dotfiles/.local/bin/imgres b/dotfiles/.local/bin/imgres
index c2f272f..4eec5f6 100755
--- a/dotfiles/.local/bin/imgres
+++ b/dotfiles/.local/bin/imgres
@@ -1,7 +1,8 @@
#!/bin/sh
if [ -z "$3" ]; then
- echo "Usage: imgres option input output"
+ echo "Usage: imgres <option> <input> <output>"
+ echo "Available options: recipe, wallpaper, thumbnail"
exit
fi
@@ -11,15 +12,20 @@ output="$3"
case "$option" in
recipe)
- convert "$input" -resize 1200x800 -quality 85 "$output"
- exiftool -overwrite_original -all= "$output"
+ convert "$input" \
+ -strip \
+ -interlace plane \
+ -define jpeg:dct-method=float \
+ -sampling-factor 4:2:0 \
+ -resize 1200x800 \
+ -quality 80 \
+ "$output"
;;
wallpaper)
convert "$input" -resize 2560x1440^ -quality 90 "$output"
;;
thumbnail)
- convert "$input" -resize 400x270 -quality 80 "$output"
- exiftool -overwrite_original -all= "$output"
+ convert "$input" -strip -interlace plane -resize 400x270 -quality 75 "$output"
;;
*)
echo "Invalid option \"$option\""