mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 13:51:31 +00:00
31 lines
796 B
Bash
Executable file
31 lines
796 B
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
# Description: Resize images in a directory to screen resolution with imgp
|
|
# imgp homepage: https://github.com/jarun/imgp
|
|
#
|
|
# Notes:
|
|
# 1. Set res if you don't want to be prompted for desktop resolution every 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
|