Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- pygame.init()
- image = pygame.image.load('bumpmap.png')
- size = image.get_size()
- f = open('bmpconv.txt', 'w')
- i = 0
- for y in range(size[1]):
- for x in range(size[0]):
- r, g, b, a = image.get_at((x, y))
- vx, vy = r, g
- s = str(hex(vx)[2:]).upper().zfill(2) + str(hex(vy)[2:]).upper().zfill(2)
- f.write(s)
- if i % 7 == 0:
- f.write('\n')
- i += 1
- f.close()
- print(size)
Advertisement
Add Comment
Please, Sign In to add comment