URI: 
       quinq-size - various - Various utilities developed at bitreich.
  HTML git clone git://bitreich.org/various/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/various/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
       ---
       quinq-size (652B)
       ---
            1 #!/bin/bash
            2 
            3 if [ $# -lt 1 ];
            4 then
            5         printf "usage: %s -|img|vid [img|vid ...]\n" "$(basename "$0")" >&2
            6         exit 1
            7 fi
            8 
            9 function toquinqsize {
           10         filename="$1"
           11         mimetype="$(file --mime-type -b "${filename}")"
           12         output="${filename%.*}_quinqsize.${filename##*.}"
           13         case "${mimetype}" in
           14         image/*)
           15                 convert "$filename" -colorspace RGB -resize '1024>' -colorspace sRGB "${output}";
           16                 ;;
           17         video/*)
           18                 ffmpeg -i "${filename}" -vf 'scale=w=min(iw\,800):h=-2' "${output}";
           19                 ;;
           20         esac
           21         printf "%s -> %s\n" "${filename}" "${output}";
           22 }
           23 
           24 if [ "$1" = "-" ];
           25 then
           26         while read -r file;
           27         do
           28                 toquinqsize "$file"
           29         done
           30 else
           31         for i in "$@";
           32         do
           33                 toquinqsize "${i}"
           34         done
           35 fi
           36