aboutsummaryrefslogtreecommitdiff
path: root/scripts/scripts/img.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/scripts/img.sh')
-rwxr-xr-xscripts/scripts/img.sh32
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
6test -z "$1" && exit
7
8W3MIMGDISPLAY="/usr/lib/w3m/w3mimgdisplay"
9FILENAME=$1
10FONTH=14 # Size of one terminal row
11FONTW=8 # Size of one terminal column
12COLUMNS=`tput cols`
13LINES=`tput lines`
14
15read width height <<< `echo -e "5;$FILENAME" | $W3MIMGDISPLAY`
16
17max_width=$(($FONTW * $COLUMNS))
18max_height=$(($FONTH * $(($LINES - 2)))) # substract one line for prompt
19
20if test $width -gt $max_width; then
21height=$(($height * $max_width / $width))
22width=$max_width
23fi
24if test $height -gt $max_height; then
25width=$(($width * $max_height / $height))
26height=$max_height
27fi
28
29w3m_command="0;1;0;0;$width;$height;;;;;$FILENAME\n4;\n3;"
30
31tput cup $(($height/$FONTH)) 0
32echo -e $w3m_command|$W3MIMGDISPLAY