推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
hellolleh
V2EX  ›  Python

写了一个好玩的脚本,图片转为文本文件

  •  1
     
  •   hellolleh · Apr 25, 2018 · 10860 views
    This topic created in 3113 days ago, the information mentioned may be changed or developed.

    Image transfer to txt

    --

    Usage

    $ python3 img_to_txt.py [file/url] [size]
    

    Example

    $ python3 img_to_txt.py http://ocas9civ7.bkt.clouddn.com/jzm.jpg
    

    This command executed, you will get a file in current folder named out.txt, and you will watch a string output in the console:

    zz

    Github 地址

    https://github.com/yaochao/img_to_txt

    55 replies  •  2018-04-27 17:52:49 +08:00
    lhx2008
    lhx2008
    Apr 25, 2018
    1
    +1,可以搞个 web 版的
    NicholasWangC
    NicholasWangC
    Apr 25, 2018 via Android❤️1
    2
    好东西,我选 jp2a
    silhouette
    silhouette
    Apr 25, 2018 via Android
    3
    +1s
    frank611
    frank611
    Apr 25, 2018 via Android
    4
    实现原理可以介绍下么?
    duan602728596
    duan602728596
    Apr 25, 2018 via iPhone❤️1
    5
    吼啊
    wanderlustLee
    wanderlustLee
    Apr 25, 2018 via iPhone
    6
    兄弟要被查水表了
    Patrick95
    Patrick95
    Apr 25, 2018
    8
    图片转字符画的 Python 项目在 GitHub 上已经有好多好多啦。
    pyufftj
    pyufftj
    Apr 25, 2018❤️1
    9
    这个人缺一副眼镜
    hellolleh
    hellolleh
    OP
    Apr 25, 2018❤️3
    10
    @frank611 原理,很简单,通过图片的像素,转为响应的字符,颜色越深,字符越密集,所谓的密集就是 @#一类的字符,不密集就是.,;一类的字符。
    Hopetree
    Hopetree
    Apr 25, 2018❤️1
    11
    可以,下午茶有了,记得来取
    shijingshijing
    shijingshijing
    Apr 25, 2018 via iPhone❤️1
    12
    月底了本来已经没名额了,楼主我还是想办法帮你弄了个名额,你在四月名单上了
    lulinux
    lulinux
    Apr 25, 2018 via Android
    13
    莫不是内个膜法大师?
    meik2333
    meik2333
    Apr 25, 2018
    14
    我之前也写了一个,把视频转换为字符画的:
    https://github.com/MeiK-h/Video2Char
    Tink
    Tink
    Apr 25, 2018❤️13
    15
    ivencooli
    ivencooli
    Apr 25, 2018 via Android❤️2
    16
    本来四月份的枪毙名单已经满了.我已经托关系把你放进去了
    shijingshijing
    shijingshijing
    Apr 25, 2018 via iPhone
    17
    @Tink 这个厉害了
    Tink
    Tink
    Apr 25, 2018
    18
    @shijingshijing #17 233 试试

    curl aoaoao.me:1926
    moxiaonai
    moxiaonai
    Apr 25, 2018 via Android
    19
    蟆
    ob
    ob
    Apr 25, 2018 via Android
    20
    还有动画版的
    ssdold
    ssdold
    Apr 25, 2018
    21
    666,fork 一发
    dobelee
    dobelee
    Apr 25, 2018 via Android
    22
    来看照片的。蛤蛤。
    Xrong
    Xrong
    Apr 25, 2018
    23
    借楼问问,有些是用 AV 封面底图拼成的图片是用哪个库实现的?
    justfun
    justfun
    Apr 25, 2018
    24
    总想搞个大新闻
    Arnie97
    Arnie97
    Apr 26, 2018 via Android
    25
    @Xrong 这个的实现恐怕太多了,自己在 GitHub 搜 photo mosaic 吧
    lvsemi1
    lvsemi1
    Apr 26, 2018 via Android
    26
    还可以玩的更高级的,通过 cleartype 的次像素渲染让单色文字玩出彩色效果来
    HW312
    HW312
    Apr 26, 2018 via Android
    27
    main 里那俩 assert 是干啥用的。。
    hard2reg
    hard2reg
    Apr 26, 2018
    28
    真正的粉丝
    stabc
    stabc
    Apr 26, 2018 via Android
    29
    为什么我点进这个帖子之后,我的系统时间走的比平时快
    wenzhoou
    wenzhoou
    Apr 26, 2018 via Android
    30
    没有人把这个事情做得更极致一些吗。现在的还是太简单了。
    xuanyuanaosheng
    xuanyuanaosheng
    Apr 26, 2018 via Android
    31
    @wenzhoou 你打算用来看电影么?
    syahd
    syahd
    Apr 26, 2018
    32
    为什么要造轮子呢,我记得 mplayer 就能将视频转换为字符界面播放。。。。
    wenzhoou
    wenzhoou
    Apr 26, 2018 via Android
    33
    @xuanyuanaosheng 我只是觉得用灰度匹配几个特定字符的做法太简单了。没想怎么去用它。如果能考虑轮廓曲线就更好了。
    xuanyuanaosheng
    xuanyuanaosheng
    Apr 26, 2018 via Android
    34
    @wenzhoou 哦哦,那个考虑的多了啊
    jisibencom
    jisibencom
    Apr 26, 2018 via Android
    35
    字符画,怎么不能动啊。my heart will go on and on
    jianjam
    jianjam
    Apr 26, 2018
    36
    支持 gif 不。。
    d0m2o08
    d0m2o08
    Apr 26, 2018❤️1
    37
    讲真,长者是真的有文化,不像我一个乡下土包子,一边上网一边查字典,旁边还得放一本怎样查字典
    whoami9894
    whoami9894
    Apr 26, 2018 via Android
    38
    话说,你的终端还能输出 emoji 表情吗
    dychenyi
    dychenyi
    Apr 26, 2018
    40
    一看就知道是谁,是不是该治疗了
    maskerTUI
    maskerTUI
    Apr 26, 2018
    41
    楼主,五月的枪毙名单了解一下
    jimmyczm
    jimmyczm
    Apr 26, 2018
    42
    +1s
    RedL0tus
    RedL0tus
    Apr 26, 2018
    43
    @xuanyuanaosheng 不過還真可以這麼做,不過用的是 libcaca (
    TimRChen
    TimRChen
    Apr 26, 2018 via Android
    44
    居然还没凉……
    JNathan
    JNathan
    Apr 26, 2018 via Android
    45
    作死 哈哈
    xuanyuanaosheng
    xuanyuanaosheng
    Apr 26, 2018 via Android
    46
    @RedL0tus 666666
    jininij
    jininij
    Apr 26, 2018 via iPhone
    47
    ffplayer 在没有图形界面下播放视频就是这个效果。偶然发现的。
    b7898585
    b7898585
    Apr 26, 2018
    48
    其实江总还是很不错的,至少那时候成克杰什么得贪污了还能有死刑
    至少那时候物价房价 10 年平稳,都没涨过,
    至少还能想着要航母,要上天。除了抓轮子,被轮子喊蛤蟆,除了怼香港记者 simple naive,江总还是值得肯定的
    对比现在的房价物价,哎。
    b7898585
    b7898585
    Apr 26, 2018
    49
    @Tink 这是药丸的节奏啊
    orm
    orm
    Apr 26, 2018
    50
    @Tink
    这个 curl aoaoao.me:1926 厉害了
    本人近视,脱了眼镜看,真是高清,哈哈
    4everYang
    4everYang
    Apr 26, 2018
    51
    估计凉了吧
    zjm168
    zjm168
    Apr 26, 2018
    52
    翻车集锦
    CasualYours
    CasualYours
    Apr 26, 2018
    53
    Excited!
    justdatadogusepy
    justdatadogusepy
    Apr 26, 2018
    54
    你这个图啊,我看了感觉很 excited !
    zysidea
    zysidea
    Apr 27, 2018
    55
    用 golang 写了一个 https://github.com/zysidea/img2txt
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1296 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 117ms · UTC 21:06 · PVG 05:06 · LAX 13:06 · JFK 16:06
    ♥ Do have faith in what you're doing.