用python完成程序员的表白

2 篇文章 0 订阅

程序员的520怎么表白

原文地址: https://github.com/HeLiangHIT/coders_love

照片墙

依赖:
pip install Image clize

使用:
python picture_wall.py --help

Usage: ./picture_wall.py [OPTIONS] [text...]

生成照片墙

Arguments:
  text...                 Text of picture wall, if not defined this will generage a rectangle picture wall

Options:
  -s, --font-size=INT     font size of a clear value (default: 20)
  -e, --edge-len=INT      sub picture's egde length (default: 50)
  -w, --wall-width=INT    picture number of rectangle width (default: 20)
  -l, --wall-length=INT   picture number of rectangle length (default: 10)
  -d, --pic-dir=STR       picture's path (default: ./img)
  -o, --out-dir=STR       output dir (default: ./out)
  -p, --font-path=STR     font path (default: ./demo.ttf)

Other actions:
  -h, --help              Show the help

for example:

./picture_wall.py I Love U -s 30 -e 10
这里写图片描述

./picture_wall.py 我爱你 -s 30 -e 10
这里写图片描述

TODO

  • 子照片的处理方式有待提升,目前采用的只是根据字体像素透明度控制透明度,还可以抽象出来让用户选择控制方式~比如:
    • 根据字体像素透明度控制子图尺寸
    • 根据字体像素透明度控制子图形状
    • 根据字体像素透明度控制子图颜色亮度
    • 或者直接采用圆形裁剪子图

爱心情书

依赖:
pip install jieba numpy pandas matplotlib wordcloud scipy wordcloud

使用:
python heart_cloud_word.py --help

Usage: ./heart_cloud_word.py [OPTIONS] [par...]

生成文字云

Arguments:
  par...

Options:
  -t, --text-file=STR   text file that contain all you word (default: ./data/love_letter.txt)
  -s, --stop-file=STR   the stop word which can't be considered (default: ./data/stopwords.txt)
  -c, --color-img=STR   the color map img (default: ./data/pink.jpg)
  -m, --mask-file=STR   the mask img for the word
  -o, --out-file=STR    output file path which should with sufix of png/jpg... (default: ./out/word_cloud.png)
  -p, --font-path=STR   font path (default: ./demo.ttf)

Other actions:
  -h, --help            Show the help

for example:

./heart_cloud_word.py
这里写图片描述

TODO

  • 增加背景照片和注释文字形成最终类似下图的效果
    这里写图片描述

如果对你有帮助~

  • 23
    点赞
  • 91
    收藏
    觉得还不错? 一键收藏
  • 12
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值