Guest User

BMPConv

a guest
Sep 4th, 2025
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. import pygame
  2.  
  3. pygame.init()
  4.  
  5. image = pygame.image.load('bumpmap.png')
  6. size = image.get_size()
  7.  
  8. f = open('bmpconv.txt', 'w')
  9.  
  10. i = 0
  11. for y in range(size[1]):
  12.     for x in range(size[0]):
  13.         r, g, b, a = image.get_at((x, y))
  14.         vx, vy = r, g
  15.         s = str(hex(vx)[2:]).upper().zfill(2) + str(hex(vy)[2:]).upper().zfill(2)
  16.         f.write(s)
  17.         if i % 7 == 0:
  18.             f.write('\n')
  19.         i += 1
  20.  
  21. f.close()
  22.  
  23. print(size)
Advertisement
Add Comment
Please, Sign In to add comment