【Python】绘图篇-《极客Python之效率革命》(小甲鱼)b站笔记

〇、前情提要

学习小甲鱼的《极客Python之效率革命》绘图篇。
参考:

  1. 【绘图篇】《极客Python之效率革命》(小甲鱼)https://www.bilibili.com/video/av34609030
  2. [模块档案] Pillow 模块中文文档
    https://fishc.com.cn/forum.php?mod=viewthread&tid=123600&extra=page%3D1%26filter%3Dtypeid%26typeid%3D701
  3. [模块档案] Pillow 快速入门手册
    https://fishc.com.cn/forum.php?mod=viewthread&tid=123606&extra=page%3D1%26filter%3Dtypeid%26typeid%3D701
  4. GitHub-captcha
    https://github.com/lepture/captcha
  5. [模块档案] wordcloud 模块中文文档
    https://fishc.com.cn/thread-140301-1-1.html

------------第一课------------

  1. [绘图] 将你的女神变成字符画
    https://fishc.com.cn/forum.php?mod=viewthread&tid=123382&extra=page%3D1%26filter%3Dtypeid%26typeid%3D720

------------第二课------------

  1. [绘图] 生成随机图片验证码和音频验证码(有彩蛋)
    https://fishc.com.cn/forum.php?mod=viewthread&tid=100696&extra=page%3D1%26filter%3Dtypeid%26typeid%3D720

------------第三课------------

  1. [绘图] 词云——将你的数据可视化的一种炫酷方案
    https://fishc.com.cn/forum.php?mod=viewthread&tid=140542&extra=page%3D1%26filter%3Dtypeid%26typeid%3D720
  2. 【爬虫篇】《极客Python之效率革命》(小甲鱼)
    https://www.bilibili.com/video/av23695737/?p=1
  3. [爬虫] 找出B站最受欢迎的编程课程
    https://fishc.com.cn/thread-140044-1-1.html
  4. 【我的笔记】【爬虫篇】《极客Python之效率革命》(小甲鱼) b站笔记
    https://blog.csdn.net/weixin_43210113/article/details/107505405
  5. 我的笔记-【mac】查找字体路径
    https://blog.csdn.net/weixin_43210113/article/details/107597992
  6. 【python】wordcloud报错AttributeError: module ‘wordcloud‘ has no attribute ‘WordCloud‘
    https://blog.csdn.net/weixin_43210113/article/details/107598217

注意:

  • Pillow 和 PIL 不能共存在同一个环境中

P1 将你的女神变成字符画

Pillow库

PIL(Python Imaging Library)库由于更新太慢,出现了Pillow库。
安装pip3 install Pillow

步骤

加载一张图片
在这里插入图片描述
将图片调整为灰度模式
在这里插入图片描述
根据图像中每个像素的灰度值(灰度深浅)找到不同复杂度的 ASCII 字符一一映射。
在这里插入图片描述

将彩色的图片转换成灰度模式
from PIL import Image

# 加载图片
img = Image.open("路径")
# 调节为灰度模式
out = img.convert("L")
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值