diff --git a/geany_run_script.sh b/geany_run_script.sh new file mode 100644 index 0000000..7d2d304 --- /dev/null +++ b/geany_run_script.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +rm $0 + +python "hac.py" + +echo " + +------------------ +(program exited with code: $?)" + + +echo "Press return to continue" +#to be more compatible with shells like dash +dummy_var="" +read dummy_var diff --git a/hac.py b/hac.py new file mode 100644 index 0000000..8ed43cf --- /dev/null +++ b/hac.py @@ -0,0 +1,111 @@ +#!/usr/bin/python +# coding: utf-8 + +import sys +import Image +import random +import os +import ImageDraw +import ImageFont +import ImageFilter +from time import gmtime, strftime +import time +import ImageEnhance +import pickle + +allongement = 2 +im1 = Image.open(str(sys.argv[1])) +im2 = Image.new("RGBA",(im1.size[0], im1.size[1])) +im3 = Image.new("RGBA",(im1.size[0], im1.size[1])) +im4 = Image.new("RGBA",(im1.size[0], im1.size[1])) +im5 = Image.new("RGBA",(im1.size[0], im1.size[1])) +im6 = Image.new("RGBA",(im1.size[0]*allongement, im1.size[1])) + +Larg = im1.size[0] +Haut = im1.size[1] +loadfile = False + +def randHaut(): + return random.randint(0, im1.size[1]/8)*8 + + +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]] +randomCoupeHauteur.sort() + + +def Hacheur(haut, bas) : + n = 0 + i = 0 + while n 1 : - im5 = im5.resize((im3.size[0]/pixelSize, im3.size[1]/pixelSize), Image.NEAREST) - im5 = im5.resize((im3.size[0]*pixelSize, im3.size[1]*pixelSize), Image.NEAREST) + boutImage = im5.resize((im5.size[0]/pixelSize, im5.size[1]/pixelSize), Image.NEAREST) + boutImage = im5.resize((im5.size[0]*pixelSize, im5.size[1]*pixelSize), Image.NEAREST) + else : + boutImage = im5 - im3 = im5.crop((0,0,cropfinal[0],cropfinal[1])) + # le sample final (bonnes dimensions) + im3 = boutImage.crop((0,0,cropfinal[0],cropfinal[1])) + print "im5.size="+str(im5.size) + print "im3.size1="+str(im3.size) + + ''' COLLAGE DU SAMPLE + ''' + while loop