From c0800c61a5e06c62e505c1dc334173dd910fc624 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 7 Aug 2015 16:53:46 +0100 Subject: [PATCH] jpg2avi, ls_img_black --- etc/profile.d/functions | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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() { -- 2.47.3