aboutsummaryrefslogtreecommitdiff
path: root/dotfiles
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2020-10-07 14:35:19 +0300
committerYaroslav <contact@yaroslavps.com>2020-10-07 14:35:19 +0300
commit895fa177e29ec897bfb9c25f117661c42817eb99 (patch)
tree16fe835a4d0a2f15112623f79c92d05a2e1451a1 /dotfiles
parente610e63c500b373832e3b4526c4d2ca2bce3b7b9 (diff)
downloadswayrice-895fa177e29ec897bfb9c25f117661c42817eb99.tar.gz
swayrice-895fa177e29ec897bfb9c25f117661c42817eb99.zip
script to resize/compress images
Diffstat (limited to 'dotfiles')
-rwxr-xr-xdotfiles/.local/bin/imgres28
1 files changed, 28 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/imgres b/dotfiles/.local/bin/imgres
new file mode 100755
index 0000000..c2f272f
--- /dev/null
+++ b/dotfiles/.local/bin/imgres
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+if [ -z "$3" ]; then
+ echo "Usage: imgres option input output"
+ exit
+fi
+
+option="$1"
+input="$2"
+output="$3"
+
+case "$option" in
+ recipe)
+ convert "$input" -resize 1200x800 -quality 85 "$output"
+ exiftool -overwrite_original -all= "$output"
+ ;;
+ wallpaper)
+ convert "$input" -resize 2560x1440^ -quality 90 "$output"
+ ;;
+ thumbnail)
+ convert "$input" -resize 400x270 -quality 80 "$output"
+ exiftool -overwrite_original -all= "$output"
+ ;;
+ *)
+ echo "Invalid option \"$option\""
+ exit
+ ;;
+esac