Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- image = pygame.image.load('image5.png');
- string = ""
- blocksize = 8
- for y in range(int(image.get_height()/blocksize)):
- for x in range(int(image.get_width()/blocksize)):
- c = image.get_at((x*blocksize+(blocksize/2),y*blocksize+(blocksize/2)))
- if (c == (0,0,0,255)):
- string += "1"
- else:
- string += "0"
- string += " "
- text_file = open("competition.txt", "w")
- text_file.write(string)
- text_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement