pillow库作图
其实数学中蕴含了一些美妙的东西,比如把圆周率用琴键敲击出来就是一首好听的乐曲。
今天我就也发现了一些数学公式中的美妙,并用python的pillow库将其呈现给大家。
当然,首先要安装pillow库
pip install pillow
主要函数
from PIL import Image
def diff_images():
img = Image.new('RGB', (256, 256), 'white')
height = img.height
width = img.width
pixcel = img.load()
for i in range(width): #二重循环给每个像素取一个颜色
for j in range(height):
pixcel[i, j] = equation(i, j) #取颜色
img.show<