]> git.nbdom.net Git - nb.git/commitdiff
jpg2avi, ls_img_black
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 7 Aug 2015 15:53:46 +0000 (16:53 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 7 Aug 2015 15:53:46 +0000 (16:53 +0100)
etc/profile.d/functions

index e80cb0f312ae2bb7336c6259bdef4442c0007b47..1695cfa5bf43aa94d722b1b354fd9969ece99d4b 100644 (file)
@@ -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() {