From 12553d99340d7e32f9c13c1d922037b30e3a6d7b Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 7 Aug 2015 16:45:41 +0100 Subject: [PATCH] jpg2avi, ls_img_black --- etc/profile.d/functions | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 9c7e9c95..e80cb0f3 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -257,25 +257,39 @@ exec "mplayer",$_[1]; ' "$@" } +ls_img_black() { + + declare threshold; threshold=10 + shell_help_noarg "Usage: $FUNCNAME [-threshold PCENT (default: $threshold)] IMG1 IMG2 ..." "$@" && return + + while [ $# -gt 0 ]; do + if [ "$1" = "-threshold" ]; then + threshold=$2; shift 2; continue + fi + #colors=$(convert $1 -format "%[mean]" info:-) + convert "$1" -threshold ${threshold}% -format %c histogram:info:- | grep -qm1 white || echo "$1" + shift + done +} + jpg2avi() { shell_help_noarg "Usage: $FUNCNAME [-h] JPG_FILES AVI_FILE" "$@" && return declare still; still=/tmp/$FUNCNAME.$$.txt; [ -x /dev/shm ] && tmp=/dev/shm/$FUNCNAME.$$.txt - #declare still; still=$FUNCNAME.txt + + declare avi jpg + declare tot; tot=$# declare count; count=0 - declare avi; #avi=${@:$#} - declare jpg; #jpg=${@:1:$(($# - 1))} - while [ $# -gt 0 ]; do count=$(($count+1)) if [ "$count" = "$tot" ]; then avi="$1"; shift; break fi - echo "$1" >> "$still" + shift done @@ -283,3 +297,5 @@ jpg2avi() { mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -mf type=jpeg:fps=24 mf://@${still} -o $avi rm -f "$still" } + + -- 2.47.3