i want to process a large number of images and store their respective
pixels in a matrix.
what is the mostt efficient way of opening and checking them?
i doubt pygame is made for this purpose :)
i guess i could also use tkinter?
and why cant i print out matrix after getting the pixels? do i have to
deinit() pygame somehow?
import pygame
import sys
import os
print os.path.exists( 'C:/users/saftarn/desktop/images/bloba.bmp')
pygame.init()
screen = pygame.display. set_mode((800, 600))
image = pygame.image.lo ad('C:/users/saftarn/desktop/images/bloba.bmp')
imrect = image.get_rect( )
imrect = imrect.move(200 , 200)
matrix = []
while 1:
pygame.display. flip()
screen.fill((25 5,255,255))
screen.blit(ima ge, imrect)
pygame.event.wa it()
event = pygame.event.wa it()
for x in range(1, 301):
for y in range(1, 301):
matrix.append(s creen.get_at((x , y)))
#print matrix
if event.type == pygame.QUIT:
#print matrix
sys.exit()
pixels in a matrix.
what is the mostt efficient way of opening and checking them?
i doubt pygame is made for this purpose :)
i guess i could also use tkinter?
and why cant i print out matrix after getting the pixels? do i have to
deinit() pygame somehow?
import pygame
import sys
import os
print os.path.exists( 'C:/users/saftarn/desktop/images/bloba.bmp')
pygame.init()
screen = pygame.display. set_mode((800, 600))
image = pygame.image.lo ad('C:/users/saftarn/desktop/images/bloba.bmp')
imrect = image.get_rect( )
imrect = imrect.move(200 , 200)
matrix = []
while 1:
pygame.display. flip()
screen.fill((25 5,255,255))
screen.blit(ima ge, imrect)
pygame.event.wa it()
event = pygame.event.wa it()
for x in range(1, 301):
for y in range(1, 301):
matrix.append(s creen.get_at((x , y)))
#print matrix
if event.type == pygame.QUIT:
#print matrix
sys.exit()
Comment