diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-03-24 11:07:14 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-03-24 11:51:33 +0530 |
commit | 0328eafcb9cff7b90963b4dd7d2bfae6eca0cbd7 (patch) | |
tree | dd161e42d29f64c83bd690466cbac76e81a9b7c5 /user-scripts/imgresize | |
parent | 653b7d9211271797e11d33bc5bb43922c0386d06 (diff) | |
download | nnn-0328eafcb9cff7b90963b4dd7d2bfae6eca0cbd7.tar.gz |
Add script to resize images in directory
Diffstat (limited to 'user-scripts/imgresize')
-rwxr-xr-x | user-scripts/imgresize | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/user-scripts/imgresize b/user-scripts/imgresize new file mode 100755 index 0000000..40b9945 --- /dev/null +++ b/user-scripts/imgresize @@ -0,0 +1,32 @@ +#!/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 + echo -n "desktop resolution (hxv): " + read res +fi + +if [ -z "$res" ]; then + if ! [ -z "$minsize" ]; then + imgp -ackx "$res" -s "$minsize" + fi +fi |