#!/usr/bin/python # coding: utf-8 # haacheuur 0.24 # port industriel de port la nouvelle - couleur - 60cm*30cm # image source : pln.jpg # image obtenue : pln..20150910-11h59m53s.jpg # pln.png 3936x1024 pix ''' image input puredata : 16384 width x 768 height donc par exemple, pour 3 images : 3 x 16384 = 49152 pixels en tout ''' import sys import Image import random import os import ImageDraw import ImageFont import ImageFilter from time import gmtime, strftime import time if not len(sys.argv) > 1: raise SystemExit("Usage: %s image_source" % sys.argv[0]) # modifs du 30/10/2013 import ImageEnhance #ouverture de l'image source et conversion en mode couleur 1bit im1 = Image.open(str(sys.argv[1])).convert('1') #im1 = Image.open(str(sys.argv[1])).convert('L') #im1 = Image.open(str(sys.argv[1])) im2 = im1.copy() #rapport d'allongement de la nouvelle image par rapport à la largeur de l'image originale allongement = 8 im3 = Image.new("RGBA",(im1.size[0], im1.size[1])) im4 = Image.new("RGBA",(im1.size[0]*allongement, im1.size[1])) #im4 = Image.new("RGBA",(49152, im1.size[1])) Larg = im1.size[0] Haut = im1.size[1] import pickle loadfile = False class Sequence: def __init__(s): randomCoupeHauteur = [] s.randomCopyPosi =[] s.proportions=[] s.choix=[] s.sizeOutput=None s.sizeInput=None """ seq = dict() seq["randomCoupeHauteur"] = [] seq["randomCopyPosi"] = [] seq["proportions"] = [] seq["choix"] = [] seq["sizeOutput"]= im4.size seq["sizeInput"] = im1.size """ if loadfile: seq=pickle.load(open("test.pickle")) else : seq=Sequence() for i in range(1): # constitution de la liste des tranches horizontales # genre comme si qu'on avait un 16 pistes :) # nombre aleatoire compris dans les limites de l'image def randHaut(): return random.randint(0, im1.size[1]/8)*8 if loadfile: randomCoupeHauteur = seq.randomCoupeHauteur else: 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(),randHaut(),randHaut(),randHaut(), \ randHaut(),randHaut(),randHaut(),randHaut(), \ im1.size[1]] # rangement des valeurs des plus petites au plus grandes randomCoupeHauteur.sort() seq.randomCoupeHauteur = randomCoupeHauteur # les hachures def Hacheur(haut, bas) : n=0 i=0 #!!!!!!!!!! while n