Ce projet essai, en partant d'une IMAGESOURCE de : - appliquer des effets à l'image - la redimmensionner - changer son mode de couleur - la HAACHEER...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gris1.py 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import sys
  4. import Image
  5. import random
  6. import os
  7. import ImageDraw
  8. import ImageFont
  9. import ImageFilter
  10. from time import gmtime, strftime
  11. # modifs du 30/10/2013
  12. import ImageEnhance
  13. im1 = Image.open(str(sys.argv[1]))
  14. im1 = im1.convert('RGB')
  15. # BLUR
  16. '''for i in range(40):
  17. im1 = im1.filter(ImageFilter.BLUR)
  18. '''
  19. #operation 'degoulinage', pixel par pixel
  20. imagesource = im1
  21. imagedest = im1
  22. for i in range (60000) :
  23. posrandX = random.randint(1, imagesource.size[0]-1)
  24. posrandY = random.randint(1, imagesource.size[1]-55)
  25. pixelRGB = imagesource.getpixel((posrandX,posrandY))
  26. for Y in range (1, 49) :
  27. imagedest.putpixel((posrandX, posrandY + random.randint(1,Y)+5), pixelRGB)
  28. imagedest.save("test.jpg"+strftime("%Y-%m-%d-%Hh%Mm%Ss", gmtime())+".jpg",quality=100)
  29. '''
  30. #collage de l'image résultante dans une image 1bit
  31. im4 = Image.new("1", (im1.size[0], im1.size[1]))
  32. im4.paste(im1, (0, 0, im1.size[0], im1.size[1]))
  33. # CTRL + S
  34. im4.save("griis-out-"+strftime("%Y-%m-%d-%Hh%Mm%Ss", gmtime())+".jpg",quality=100)
  35. '''
  36. #COPIER/COLLAGE SIMPLE ET EFFICACE :
  37. '''
  38. box = (30, 30, 110, 110)
  39. sample = image.crop(box)
  40. for i in range(10): # with the BLUR filter, you can blur a few times to get the effect you're seeking
  41. sample = sample.filter(ImageFilter.BLUR)
  42. image.paste(sample, box)
  43. '''