# Créé par prof, le 20/06/2016 en Python 3.2 # 20 juin 2016 : utilisation du module PIL pour créer une image from PIL import Image from math import * res_x=600 res_y=600 size=(res_x,res_y) im=Image.new('RGB',size) pix=im.load() for n in range(1,5): for x in range(res_x): for y in range(res_y): pix[x,y]=(x+y)*n*int(x*sin(y/10)+y*cos(x/10)) nom_fic='toto_'+str(n)+'.png' print('Enregistrement du fichier '+nom_fic+' ...') im.save(nom_fic)