0
推荐
1374
阅读
Python实现手绘功能
手绘图确实很好看,但对于手残党的我,只能呵呵一笑,今天就用代码来实现手绘功能,把普通的图片转换为手绘图片。代码from PIL import Image
import numpy as np
a = np.asarray(Image.open(r'C:\Users\luopan\Desktop\1.jpg').convert('L')).astype('float')
depth = 10. # (0-100)
grad = np.gradient(a) # 取图像...
0
推荐
1327
阅读
GIF图倒序播放
今天在爬虫群,看到一个有趣的Python代码,可以把GIF图倒序播放,代码很简单,首先要安装pillow库。代码from PIL import Image,ImageSequence
with Image.open('C:/Users/LP/Desktop/timg.gif') as im:
if im.is_animated: #判断是否为动态
frames = [f.copy() for f in ImageSequence.Iterator(im)] #把每...
0
推荐
1372
阅读
微信好友全头像
直接上图代码import itchat
import math
import PIL.Image as Image
import os
itchat.auto_login()
friends = itchat.get_friends(update=True)[0:]
user = friends[0]["UserName"]
num = 0
for i in friends:
img = itchat.get_head_img(userName=i["UserName"])
fileImage = open('文件夹路径' + "/" + str...