diff options
Diffstat (limited to 'scripts/scripts/img.sh')
-rwxr-xr-x | scripts/scripts/img.sh | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/scripts/scripts/img.sh b/scripts/scripts/img.sh deleted file mode 100755 index baea386..0000000 --- a/scripts/scripts/img.sh +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # z3bra -- 2014-01-21 | ||
4 | # http://blog.z3bra.org/2014/01/images-in-terminal.html | ||
5 | |||
6 | test -z "$1" && exit | ||
7 | |||
8 | W3MIMGDISPLAY="/usr/lib/w3m/w3mimgdisplay" | ||
9 | FILENAME=$1 | ||
10 | FONTH=14 # Size of one terminal row | ||
11 | FONTW=8 # Size of one terminal column | ||
12 | COLUMNS=`tput cols` | ||
13 | LINES=`tput lines` | ||
14 | |||
15 | read width height <<< `echo -e "5;$FILENAME" | $W3MIMGDISPLAY` | ||
16 | |||
17 | max_width=$(($FONTW * $COLUMNS)) | ||
18 | max_height=$(($FONTH * $(($LINES - 2)))) # substract one line for prompt | ||
19 | |||
20 | if test $width -gt $max_width; then | ||
21 | height=$(($height * $max_width / $width)) | ||
22 | width=$max_width | ||
23 | fi | ||
24 | if test $height -gt $max_height; then | ||
25 | width=$(($width * $max_height / $height)) | ||
26 | height=$max_height | ||
27 | fi | ||
28 | |||
29 | w3m_command="0;1;0;0;$width;$height;;;;;$FILENAME\n4;\n3;" | ||
30 | |||
31 | tput cup $(($height/$FONTH)) 0 | ||
32 | echo -e $w3m_command|$W3MIMGDISPLAY | ||