V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
notolddriver
V2EX  ›  Linux

如何在 Linux 终端下打印出信息二维码图形

  •  1
     
  •   notolddriver · 2016-07-21 16:51:38 +08:00 · 12866 次点击
    这是一个创建于 2833 天前的主题,其中的信息可能已经有所发展或是发生改变。

    为了方便信息处理,想在 putty 或者 xShell 这种 ssh 终端下,直接输出所需信息的二维码图形。不知有没有 dalao 司机 做过这个。看了一番,就找到个 dialog 命令可以图形配置一些东西,但不太适合我这个需求。 用屁股想了想,基本肯定是可以实现的[毕竟 dialog 输出图形了,二维码只需要黑白色即可],但不知道这个轮子是不是已经有人造过了呢。

    效果大概如下:
    http://108.61.250.6/qr.jpg
    
    第 1 条附言  ·  2016-07-21 18:06:07 +08:00
    问题已经完美解决。

    方法:

    安装 qrencode 包就可以了。

    Fedora:
    sudo dnf install qrencode

    Centos:
    yum install qrencode

    使用方法:
    echo 'http://108.61.250.6/skydiver.jpg' | qrencode -o - -t UTF8

    效果见:
    http://108.61.250.6/skydiver.jpg

    感谢 @skydiver
    11 条回复    2020-01-06 09:13:26 +08:00
    GordianZ
        1
    GordianZ  
    MOD
       2016-07-21 16:53:21 +08:00   ❤️ 2
    uuair
        2
    uuair  
       2016-07-21 16:58:07 +08:00
    @GordianZ 老司机,这个好棒!!!
    notolddriver
        3
    notolddriver  
    OP
       2016-07-21 17:01:57 +08:00
    @GordianZ 谢谢 dalao ,之前谷歌到过,因为看到 有 node 命令。对 nodejs 不了解,所以看了一眼就关掉了。。
    skydiver
        4
    skydiver  
       2016-07-21 17:05:36 +08:00
    安装 qrencode 包就可以了。 Fedora 下是 sudo dnf install qrencode

    使用方法:

    echo 'http://108.61.250.6/qr.jpg ‘ | qrencode -o - -t UTF-8
    skydiver
        5
    skydiver  
       2016-07-21 17:06:53 +08:00   ❤️ 1
    上面写错字符了,应该是

    % echo 'http://108.61.250.6/qr.jpg' | qrencode -o - -t UTF8
    notolddriver
        6
    notolddriver  
    OP
       2016-07-21 17:38:34 +08:00
    你在 4 楼写的是对的啊 不用%符号啊 多谢哦

    http://108.61.250.6/skydiver.jpg

    @skydiver
    notolddriver
        7
    notolddriver  
    OP
       2016-07-21 17:42:00 +08:00
    @skydiver 好吧 貌似你是在说 单引号
    Izual_Yang
        8
    Izual_Yang  
       2016-12-28 21:42:26 +08:00   ❤️ 1
    github 上找到的:
    https://github.com/fumiyas/qrc 末尾还列了其他语言的轮子
    支持 windows (可能需要 iconv 一下?)
    以及某个变态批处理: http://www.dostips.com/forum/viewtopic.php?t=6038
    chao591
        9
    chao591  
       2017-02-10 22:05:40 +08:00   ❤️ 1
    https://github.com/alishtory/qrcode-terminal
    这个模块可以在控制台完美打印额
    simerpc
        10
    simerpc  
       2019-06-17 17:47:20 +08:00
    qrcode-terminal 也是用 qrcode 的,直接使用 qrcode 里面有个方法 print_ascii 即可终端打印,白底黑块加 invert=True
    Firxiao
        11
    Firxiao  
       2020-01-06 09:13:26 +08:00
    推荐一个在线使用 api 生成的. http://qrenco.de/


    Append the string that you want to encode to qrenco.de/ in the URL
    or pipe the string into curl -F


    $ printf "two\nlines" \

    $ curl qrenco.de/this | curl -F-=\<- qrenco.de
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3682 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 00:09 · PVG 08:09 · LAX 17:09 · JFK 20:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.