Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import pygame
  2.  
  3. image = pygame.image.load('image5.png');
  4.  
  5. string = ""
  6. blocksize = 8
  7. for y in range(int(image.get_height()/blocksize)):
  8. for x in range(int(image.get_width()/blocksize)):
  9. c = image.get_at((x*blocksize+(blocksize/2),y*blocksize+(blocksize/2)))
  10. if (c == (0,0,0,255)):
  11. string += "1"
  12. else:
  13. string += "0"
  14. string += " "
  15.  
  16. text_file = open("competition.txt", "w")
  17. text_file.write(string)
  18. text_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement