sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

imgresize (790B)


      1 #!/usr/bin/env sh
      2 
      3 # Description: Resize images in a directory to screen resolution with imgp
      4 #
      5 # Dependencipes: imgp - https://github.com/jarun/imgp
      6 #
      7 # Notes:
      8 #   1. Set res to avoid the desktop resolution prompt each time
      9 #   2. MINSIZE is set to 1MB by default, adjust it if you want
     10 #   3. imgp options used:
     11 #      a - adaptive mode
     12 #      c - convert PNG to JPG
     13 #      k - skip images matching specified hres/vres
     14 #
     15 # Shell: POSIX compliant
     16 # Author: Arun Prakash Jana
     17 
     18 # set resolution (e.g. 1920x1080)
     19 res="${RESOLUTION}"
     20 
     21 # set minimum image size (in bytes) to resize (default: 1MB)
     22 MINSIZE="${MINSIZE:-1048576}"
     23 
     24 if [ -z "$res" ]; then
     25     printf "desktop resolution (hxv): "
     26     read -r res
     27 fi
     28 
     29 if [ -n "$res" ] && [ -n "$MINSIZE" ]; then
     30     imgp -ackx "$res" -s "$MINSIZE"
     31 fi