2019-03-24 05:37:14 +00:00
|
|
|
#!/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=
|
|
|
|
|
|
|
|
# set minimum image size (in bytes) to resize (default: 1MB)
|
|
|
|
minsize=1048576
|
|
|
|
|
|
|
|
if [ -z "$res" ]; then
|
2019-11-21 20:44:25 +00:00
|
|
|
printf "desktop resolution (hxv): "
|
|
|
|
read -r res
|
2019-03-24 05:37:14 +00:00
|
|
|
fi
|
|
|
|
|
2019-11-17 15:32:43 +00:00
|
|
|
if ! [ -z "$res" ] && ! [ -z "$minsize" ]; then
|
|
|
|
imgp -ackx "$res" -s "$minsize"
|
2019-03-24 05:37:14 +00:00
|
|
|
fi
|