#!/usr/bin/python # coding: utf-8 # haacheuur 0.24 # port industriel de port la nouvelle - couleur - 60cm*30cm # image source : pln.jpg # image rendue : pln..20150910-11h59m53s.jpg import sys import Image import random import os import ImageDraw import ImageFont import ImageFilter from time import gmtime, strftime import time # modifs du 30/10/2013 import ImageEnhance #ouvertrure de l'image source et conversion en mode 1bit im1 = Image.open(str(sys.argv[1])).convert('1') #im1 = Image.open(str(sys.argv[1])) im2 = im1.copy() #im3 = Image.new("1", (im1.size[0], im1.size[1])) #im4 = Image.new("1", (im1.size[0]*3, im1.size[1])) #rapport d'allongement de la nouvelle image par rapport à la largeur de l'image originale allongement = 1 im3 = Image.new("RGBA",(im1.size[0], im1.size[1])) im4 = Image.new("RGBA",(im1.size[0]*allongement, im1.size[1])) Larg = im1.size[0] Haut = im1.size[1] for i in range(10): # nombre aleatoire compris dans les limites de l'image def randHaut(): return random.randint(0, im1.size[1]) # constitution de la liste des tranches horizontales # genre comme si qu'on avait un 16 pistes :) randomCoupeHauteur = [0, \ randHaut(),randHaut(),randHaut(),randHaut(),randHaut(), \ randHaut(),randHaut(),randHaut(),randHaut(),randHaut(), \ randHaut(),randHaut(),randHaut(),randHaut(),randHaut(), \ randHaut(),randHaut(),randHaut(),randHaut(),randHaut(), \ randHaut(),randHaut(),randHaut(),randHaut(),randHaut(), \ im1.size[1]] # rangement des valeurs des plus petites au plus grandes randomCoupeHauteur.sort() # DEBUG liste = [] # les hachures def Hacheur(haut, bas) : n=0 while n< ------------------------------------------------------------------ # tirage au sort #randomFacteur = random.randint(0, len(randomListe)*3) choix = 0 # DEBUG #print len(randomListe)*3 # ponderation du tirage au sort randomFacteur = random.randint(0, len(randomListe)-1) # DEBUG #liste.append(choix) # assignation des valeurs (paires) finales choisies randomCopyLargFinal = randomListe[randomFacteur][0] repeat = randomListe[randomFacteur][1] # positionnement de la copie, aleatoirement, entre 0 et la largeur totale de l'image randomCopyPosi = random.randint(0, (im1.size[0]-randomCopyLargFinal)) cx1 = randomCopyPosi cx2 = randomCopyPosi + randomCopyLargFinal # decoupage du sample im3 = im2.crop((cx1,haut,cx2,bas)) # 8>< ------------------------------------------------------------------ draw = ImageDraw.Draw(im4) loop = 0 #collage, n fois, du sample while loop