From: Nicolas Boisselier Date: Fri, 7 Aug 2015 15:53:46 +0000 (+0100) Subject: jpg2avi, ls_img_black X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=c0800c61a5e06c62e505c1dc334173dd910fc624;p=nb.git jpg2avi, ls_img_black --- diff --git a/etc/profile.d/functions b/etc/profile.d/functions index e80cb0f3..1695cfa5 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -260,16 +260,27 @@ exec "mplayer",$_[1]; ls_img_black() { declare threshold; threshold=10 - shell_help_noarg "Usage: $FUNCNAME [-threshold PCENT (default: $threshold)] IMG1 IMG2 ..." "$@" && return + declare ret; ret=1 + + shell_help_noarg "Usage: $FUNCNAME [-threshold PCENT (default: $threshold)] IMG1 IMG2 ..." "$@" && return 1 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" + + if ! convert "$1" -threshold ${threshold}% -format %c histogram:info:- | grep -qm1 white; then + echo "$1" + ret=0 + fi shift + done + + return $ret } jpg2avi() {