aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/imgres
blob: 4eec5f6f5dfd5201db53b39ad940d4c402ba16f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh

if [ -z "$3" ]; then
    echo "Usage: imgres <option> <input> <output>"
    echo "Available options: recipe, wallpaper, thumbnail"
    exit
fi

option="$1"
input="$2"
output="$3"

case "$option" in
    recipe)
        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" -strip -interlace plane -resize 400x270 -quality 75 "$output"
        ;;
    *)
        echo "Invalid option \"$option\""
        exit
        ;;
esac