Advertisement
Guest User

roast me cowards

a guest
Jul 17th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. #todo: learn how to use iterators before I blow my brains out
  2. from PIL import Image, ImageDraw
  3. import sys,random,numpy
  4. image_width=400
  5. image_height=400
  6. points_hor=5
  7. points_ver=6
  8.  
  9. #why didnt i just use numpy's randint before? great question
  10. points = numpy.random.randint(256, size=(points_ver,points_hor))
  11. print(points)
  12. #deliberate misnomer for deliberate obfuscation and because its funny
  13. points_slopes = numpy.zeros((points_ver-1,points_hor-1))
  14. for y in range(0,points_ver-1):
  15. for x in range(0,points_hor-1):
  16. points_slopes[y][x] = (points[y][x+1]-points[y][x])/(image_width/points_hor)
  17. print(points_slopes)
  18. #uHHhHhHHhHHhHHH
  19. noise = Image.new('RGBA', [image_width, image_height], (255,255,255,200))
  20. draw_noise = ImageDraw.Draw(noise)
  21. draw_noise.rectangle([(0,0),(image_width,image_height)],fill=(10,230,230,255))
  22. #the process
  23. #for x in range(0, points_ver):
  24. # for y in range(0, points_hor):
  25. #draws ea point at location. (get ready for bilerp KRHSKJHKJEHSDKJKJHDSFKJHSD)
  26. # draw_noise.point([int(image_width/points_ver*x),int(image_height/points_hor*y)], (points[x][y],points[x][y],points[x][y],255))
  27.  
  28. for x in range(0,image_width):
  29. for y in range(0,image_height):
  30. calc_color = int((x*points_slopes[int(y/(image_height/(points_ver-1)))][int(x/(image_width/(points_hor-1)))])+points[int(y/(image_height/(points_ver)))][int(x/(image_width/(points_hor)))])
  31. draw_noise.point([x,y],(calc_color,calc_color,calc_color,255))
  32.  
  33. del draw_noise
  34. noise.save(str(points)+ "value noise",format="PNG")
  35. noise.show()
  36.  
  37. #when u cant do MATh,,,,,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement