un peu de cleanage, genre suppression de commentaires
This commit is contained in:
parent
0c2deac74d
commit
a581bdb42c
36
hacheuur.py
36
hacheuur.py
@ -6,7 +6,6 @@
|
|||||||
# image source : pln.jpg
|
# image source : pln.jpg
|
||||||
# image rendue : pln..20150910-11h59m53s.jpg
|
# image rendue : pln..20150910-11h59m53s.jpg
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import Image
|
import Image
|
||||||
import random
|
import random
|
||||||
@ -14,7 +13,6 @@ import os
|
|||||||
import ImageDraw
|
import ImageDraw
|
||||||
import ImageFont
|
import ImageFont
|
||||||
import ImageFilter
|
import ImageFilter
|
||||||
|
|
||||||
from time import gmtime, strftime
|
from time import gmtime, strftime
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -23,10 +21,7 @@ import ImageEnhance
|
|||||||
|
|
||||||
#ouvertrure de l'image source et conversion en mode 1bit
|
#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])).convert('1')
|
||||||
#im1 = Image.open(str(sys.argv[1]))
|
|
||||||
im2 = im1.copy()
|
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
|
#rapport d'allongement de la nouvelle image par rapport à la largeur de l'image originale
|
||||||
allongement = 1
|
allongement = 1
|
||||||
@ -38,7 +33,6 @@ Larg = im1.size[0]
|
|||||||
Haut = im1.size[1]
|
Haut = im1.size[1]
|
||||||
|
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
|
|
||||||
# nombre aleatoire compris dans les limites de l'image
|
# nombre aleatoire compris dans les limites de l'image
|
||||||
def randHaut(): return random.randint(0, im1.size[1])
|
def randHaut(): return random.randint(0, im1.size[1])
|
||||||
|
|
||||||
@ -60,41 +54,17 @@ for i in range(10):
|
|||||||
|
|
||||||
# les hachures
|
# les hachures
|
||||||
def Hacheur(haut, bas) :
|
def Hacheur(haut, bas) :
|
||||||
|
|
||||||
n=0
|
n=0
|
||||||
|
|
||||||
while n<im4.size[0] :
|
while n<im4.size[0] :
|
||||||
|
|
||||||
# constitution d'une liste de dimensions et de repetitions
|
|
||||||
#dimen FAAAAT
|
|
||||||
#randomListe = [(10240,1),(5120,1),(2560,1),(1280,2),(640,4),(320,8),(320,3),(160,12),(160,6),(120,8),(80,24),(40,16),(20,32),(20,16),(10,32),(10,16),(5,64)]
|
|
||||||
#dimen FUZITU
|
|
||||||
|
|
||||||
#PLN back
|
|
||||||
#randomListe = [(2560,1),(1280,2),(640,4),(320,8),(320,3),(160,12),(160,6),(120,8),(80,24),(40,16),(20,24),(20,16),(10,32),(10,16),(5,64),(2,64),(1,64),(1,16)]
|
|
||||||
|
|
||||||
#PLN recursif sept 2015
|
|
||||||
#randomListe = [(2560,1),(1280,2),(640,4),(320,8),(320,3),(160,12),(160,6),(120,8),(80,24),(40,16),(20,24),(20,16),(10,32),(10,16),(5,64)]
|
|
||||||
#randomListe = [(5120,1),(2560,1),(1280,2),(640,4),(320,8),(320,3),(160,12),(160,6),(120,8),(80,24),(40,16),(10,32),(5,64),(3,24)]
|
|
||||||
# test HH_
|
|
||||||
randomListe = [(1280,2),(640,4),(320,5),(240,4),(160,6),(120,4),(120,8),(80,16),(60,16),(20,32),(8,24),(8,16),(5,64),(3,24),(2,24),(1,128),(1,64),(1,6)]
|
randomListe = [(1280,2),(640,4),(320,5),(240,4),(160,6),(120,4),(120,8),(80,16),(60,16),(20,32),(8,24),(8,16),(5,64),(3,24),(2,24),(1,128),(1,64),(1,6)]
|
||||||
|
|
||||||
#dimen BLOG CUMULONIMBUS
|
|
||||||
#randomListe = [(320,8),(320,3),(160,12),(160,6),(120,8),(80,24),(40,16),(20,32),(20,16),(10,32),(10,16),(5,64)]
|
|
||||||
# repeter ce qui suit 2 ou 3 fois pour realiser non pas
|
|
||||||
# un sample, mais carrement ue sequence
|
|
||||||
# 8>< ------------------------------------------------------------------
|
|
||||||
# tirage au sort
|
|
||||||
#randomFacteur = random.randint(0, len(randomListe)*3)
|
|
||||||
choix = 0
|
choix = 0
|
||||||
|
|
||||||
# DEBUG
|
|
||||||
#print len(randomListe)*3
|
|
||||||
|
|
||||||
# ponderation du tirage au sort
|
# ponderation du tirage au sort
|
||||||
randomFacteur = random.randint(0, len(randomListe)-1)
|
randomFacteur = random.randint(0, len(randomListe)-1)
|
||||||
|
|
||||||
# DEBUG
|
|
||||||
#liste.append(choix)
|
|
||||||
|
|
||||||
# assignation des valeurs (paires) finales choisies
|
# assignation des valeurs (paires) finales choisies
|
||||||
randomCopyLargFinal = randomListe[randomFacteur][0]
|
randomCopyLargFinal = randomListe[randomFacteur][0]
|
||||||
repeat = randomListe[randomFacteur][1]
|
repeat = randomListe[randomFacteur][1]
|
||||||
@ -106,7 +76,6 @@ for i in range(10):
|
|||||||
cx2 = randomCopyPosi + randomCopyLargFinal
|
cx2 = randomCopyPosi + randomCopyLargFinal
|
||||||
# decoupage du sample
|
# decoupage du sample
|
||||||
im3 = im2.crop((cx1,haut,cx2,bas))
|
im3 = im2.crop((cx1,haut,cx2,bas))
|
||||||
# 8>< ------------------------------------------------------------------
|
|
||||||
|
|
||||||
draw = ImageDraw.Draw(im4)
|
draw = ImageDraw.Draw(im4)
|
||||||
loop = 0
|
loop = 0
|
||||||
@ -164,7 +133,6 @@ for i in range(10):
|
|||||||
im4.save(script+"."+n+"_"+strftime("%Y%m%d-%Hh%Mm%Ss", gmtime())+".png",'PNG', quality=100)
|
im4.save(script+"."+n+"_"+strftime("%Y%m%d-%Hh%Mm%Ss", gmtime())+".png",'PNG', quality=100)
|
||||||
|
|
||||||
#print script+"."+str(i)+"_"+strftime("%Y%m%d-%Hh%Mm%Ss", gmtime())+".jpg"
|
#print script+"."+str(i)+"_"+strftime("%Y%m%d-%Hh%Mm%Ss", gmtime())+".jpg"
|
||||||
|
|
||||||
#millis = int(round(time.time() * 1000))
|
#millis = int(round(time.time() * 1000))
|
||||||
#print "millis-secondes : "+str(millis)
|
#print "millis-secondes : "+str(millis)
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ fichier=sys.argv[1]
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
#Image.open(fichier).save(outfile)
|
|
||||||
im1 = Image.open(fichier).convert('1')
|
im1 = Image.open(fichier).convert('1')
|
||||||
im2 = im1.copy()
|
im2 = im1.copy()
|
||||||
im3 = im1.copy()
|
im3 = im1.copy()
|
||||||
@ -26,19 +25,9 @@ while x < im1.size[0] :
|
|||||||
|
|
||||||
y = y + 1
|
y = y + 1
|
||||||
|
|
||||||
#draw = ImageDraw.Draw(im2)
|
|
||||||
#lignes noires 1px autour
|
|
||||||
#draw.line((0, 0, im3.size[0]-1, 0), fill="rgb(255,255,255)")
|
|
||||||
#draw.line((x, 0, x, im2.size[1]-1), fill="rgb(255,0,0)")
|
|
||||||
|
|
||||||
#------------------------------------------
|
|
||||||
# ALPHA tout bete :
|
# ALPHA tout bete :
|
||||||
im3 = Image.blend(im1, im2, 0.8)
|
im3 = Image.blend(im1, im2, 0.8)
|
||||||
|
|
||||||
# COMPOSITING :
|
|
||||||
# im3 = Image.composite(im1, im2, mask)
|
|
||||||
#im3 = Image.composite(im1, im2, im1)
|
|
||||||
#------------------------------------------
|
|
||||||
|
|
||||||
n = "%05d" % x
|
n = "%05d" % x
|
||||||
nomdefichier = "horizontal"+n+".png"
|
nomdefichier = "horizontal"+n+".png"
|
||||||
@ -47,22 +36,15 @@ while x < im1.size[0] :
|
|||||||
|
|
||||||
x = x + 1
|
x = x + 1
|
||||||
|
|
||||||
#im4.save(script+"."+strftime('%Y%m%d-%Hh%Mm%Ss', gmtime())+".jpg",'JPEG', quality=100)
|
|
||||||
|
|
||||||
del draw
|
del draw
|
||||||
|
|
||||||
#os.system("ffmpeg -i horizontal%d.png -vcodec mjpeg -q:v 0 "+fichier+".avi")
|
|
||||||
|
|
||||||
os.system("ffmpeg -i horizontal%05d.png -i "+fichier+".enscribe.norm.wav -c:a libfaac -c:v libx264 -preset ultrafast -crf 32 "+fichier+".final.mp4")
|
os.system("ffmpeg -i horizontal%05d.png -i "+fichier+".enscribe.norm.wav -c:a libfaac -c:v libx264 -preset ultrafast -crf 32 "+fichier+".final.mp4")
|
||||||
|
|
||||||
print " OUTPUT FINAL : "+fichier+".final.mp4"
|
print " OUTPUT FINAL : "+fichier+".final.mp4"
|
||||||
|
|
||||||
|
# Nettoyage
|
||||||
#os.system("rm horizontal*.png")
|
os.system("rm horizontal*.png")
|
||||||
|
|
||||||
|
|
||||||
# ALPHA :
|
|
||||||
# out = image1 * (1.0 - alpha) + image2 * alpha
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user