mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Add script to resize images in directory
This commit is contained in:
parent
653b7d9211
commit
0328eafcb9
|
@ -6,6 +6,7 @@
|
||||||
| edit | Fuzzy find a file in directory subtree with fzy and edit in vim |
|
| edit | Fuzzy find a file in directory subtree with fzy and edit in vim |
|
||||||
| fzy | Fuzzy find a file in directory subtree with fzy and open using xdg-open |
|
| fzy | Fuzzy find a file in directory subtree with fzy and open using xdg-open |
|
||||||
| hexview | view a file in hex; needs xxd and $PAGER |
|
| hexview | view a file in hex; needs xxd and $PAGER |
|
||||||
|
| imgresize | Resize images in directory to screen resolution (needs [imgp](https://github.com/jarun/imgp)) |
|
||||||
| imgur | Upload an image file to imgur |
|
| imgur | Upload an image file to imgur |
|
||||||
| kdeconnect | Send selected files to Android device using kdeconnect-cli |
|
| kdeconnect | Send selected files to Android device using kdeconnect-cli |
|
||||||
| ndiff | File and directory diff for selection using vimdiff |
|
| ndiff | File and directory diff for selection using vimdiff |
|
||||||
|
|
32
user-scripts/imgresize
Executable file
32
user-scripts/imgresize
Executable file
|
@ -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
|
Loading…
Reference in a new issue