X-Git-Url: http://git.plutz.net/?p=stereofy;a=blobdiff_plain;f=stereofy.sh;h=51cbfb15c1579d9ed02deb0f08ddbc3e73f8ebd2;hp=d3f4763ec058df59fa2f075dd5b56b728c890fda;hb=b53924ca320e6ac8607a76d66cf7a7249f7b248a;hpb=d756f57d5612c2fa4b6fff7db9af57ffbaef59cc diff --git a/stereofy.sh b/stereofy.sh index d3f4763..51cbfb1 100755 --- a/stereofy.sh +++ b/stereofy.sh @@ -1,7 +1,22 @@ #!/bin/sh +# Copyright 2011 Paul Hänsch +# This file is part of Stereofy +# +# Stereofy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Stereofy is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Stereofy. If not, see . algo="d" #algorythm, Dubois by default -model="rc" #color model, green-magenta by default +model="rc" #color model, red-cyan by default param="" #leave blank, will be -$algo$model left='' right='' @@ -15,7 +30,7 @@ while [ -n "$1" ]; do -rc|--rc|--red-cyan) model="rc";; -mc|--mc|--magenta-cyan) model="mc";; -gm|--gm|--green-magenta) model="gm";; - -ab|--ab|--amber-blue|yellow-blue) model="ab";; + -ab|--ab|--amber-blue|--yellow-blue) model="ab";; -[dfh]rc|-[dfh]gm|-[fe]mc|-dab) param="$1";; -*) echo "no such color model" >/dev/stderr; exit 1;; *) if [ -z "$left" ]; then @@ -33,19 +48,15 @@ done [ -z "$param" ] && param="-$algo$model" [ -z "$stereo" ] && stereo="${left}_stereo.jpg" +echo -n preparing... geom=$(identify "$left" |sed -rn 's:^.* ([0-9]+x[0-9]+) .*$:\1:gp') +tmp=$(tempfile -d /tmp -p strfy) +rm "$tmp" +mkfifo "$tmp" -echo -n bitmapping... -stream "$left" "$left.bts" -stream "$right" "$right.bts" - +convert "$left" rgb:- >"$tmp" & echo -n anaglyphing... -anaglyph "$param" "$left.bts" "$right.bts" "$stereo.bts" - -if [ $? = 0 ]; then - echo -n converting... - convert -depth 8 -size "$geom" "rgb:$stereo.bts" "$stereo" -fi +convert "$right" rgb:- |anaglyph "$param" "$tmp" /dev/stdin /dev/stdout |convert -depth 8 -size "$geom" rgb:- "$stereo" echo cleaning... -rm "$left.bts" "$right.bts" "$stereo.bts" 2>/dev/null +rm "$tmp"