File: imgresize

package info (click to toggle)
nnn 5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,184 kB
  • sloc: ansic: 11,902; sh: 3,585; makefile: 512; cpp: 80; python: 31; csh: 2
file content (31 lines) | stat: -rwxr-xr-x 790 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env sh

# Description: Resize images in a directory to screen resolution with imgp
#
# Dependencipes: imgp - https://github.com/jarun/imgp
#
# Notes:
#   1. Set res to avoid the desktop resolution prompt each time
#   2. MINSIZE is set to 1MB by default, adjust it if you want
#   3. imgp options used:
#      a - adaptive mode
#      c - convert PNG to JPG
#      k - skip images matching specified hres/vres
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana

# set resolution (e.g. 1920x1080)
res="${RESOLUTION}"

# set minimum image size (in bytes) to resize (default: 1MB)
MINSIZE="${MINSIZE:-1048576}"

if [ -z "$res" ]; then
    printf "desktop resolution (hxv): "
    read -r res
fi

if [ -n "$res" ] && [ -n "$MINSIZE" ]; then
    imgp -ackx "$res" -s "$MINSIZE"
fi