因为工作中需要用到一些特殊的图卡,使用windows自带的画图工具不好实现,将python生成图卡的学习记录保留在这里。
本文主要是根据提供的像素RGB值来生成指定图卡,方便左右屏幕单独显示。
import random
from PIL import Image, ImageDraw, ImageFilter
def rndColor():
return (random.randint(128, 255), random.randint(128, 255), random.randint(128, 255))
def leftColor():
return (220, 220, 220)
def rightColor():
return (170, 170, 170)
def singleColor():
image = Image.new('RGB', (3648,1920), (255, 255, 255))
draw = ImageDraw.Draw(image)
for x in range(24, 1823):
for y in range(1920):
draw.point((x, y), fill=leftColor())
for x in range(1847, 3647):
for y in range(1920):
draw.point((x, y), fill=rightColor())
image.save('singleColor.png','png')
def mixRowColor():
image = Image.new('RGB', (3648,1920), (255, 255, 255))
draw = ImageDraw.Draw(image)
for x in range(24, 1823, 2):
for y in range