一张包含所有颜色的图片
图片:
使用pygame编写的代码
源代码:
import pygame pygame.init() canvas=pygame.Surface((4096,4096)) rgb=[0,0,0] x_y=[0,0] for r in range(256): rgb[2]=0 rgb[1]=0 for g in range(256): rgb[2]=0 for b in range(256): pygame.draw.rect(canvas,rgb, (x_y,(1,1)) ) print(rgb) x_y[0]+=1 if x_y[0]>4096: x_y[0]=0 x_y[1]+=1 rgb[2]=rgb[2]+1 rgb[1]+=1 rgb[0]+=1 pygame.image.save(canvas,"color.jpg")