深度终端不支持显示图片
Tofloor
poster avatar
linusboyle
deepin
2018-07-11 20:39
Author
本帖最后由 linusboyle 于 2018-7-11 12:42 编辑

我有脚本如下:(说明一下,就是直接在终端打印图片的小脚本)
#!/bin/bash
#
# z3bra -- 2014-01-21
#show img in terminal using w3mimgdisplay


test -z "$1" && exit

clear

W3MIMGDISPLAY="/usr/lib/w3m/w3mimgdisplay"
FILENAME=$1
FONTH=21 # Size of one terminal row
FONTW=11  # Size of one terminal column
COLUMNS=`tput cols`
LINES=`tput lines`

read width height <<< `echo -e "5;$FILENAME" | $W3MIMGDISPLAY`

max_width=$(($FONTW * $COLUMNS))
max_height=$(($FONTH * $(($LINES -2)) ))

if test $width -gt $max_width ; then
    height=$(($height * $max_width / $width))
    width=$max_width
fi

if test $height -gt $max_height ; then
    width=$(($width * $max_height / $height))
    height=$max_height
fi

w3m_command="0;1;0;0;$width;$height;;;;;$FILENAME\n4;\n3;"

tput cup $(($height/$FONTH)) 0
echo -e $w3m_command|$W3MIMGDISPLAY


在urxvt和xterm打印得好好的,深度终端就不行。

(urxvt-256色版本)
这不是脚本本身的问题,打开w3m预览图片或者ranger,终端也是没法预览图片


Reply Favorite View the author
All Replies
avatar
linusboyle
deepin
2018-07-11 21:01
#1
这不是bug,毕竟这特性没什么人用
想知道有没有折腾的办法
Reply View the author