[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Problem with pygame.image.load() and a gzip.open() stream



I have a bmp image file that loads fine with:

fid = open('test.bmp','rb')
theimg = pygame.image.load(fid)
fid.close()

"file test.bmp" yields the expected
test.bmp: PC bitmap data, Windows 3.x format, 512 x 512 x 8

but if I gzip the image using "gzip test.bmp" then try

fid = gzip.open('test.bmp.gz','rb')
theimg = pygame.image.load(fid)
fid.close()

I get an error:
theimg = pygame.image.load(fid)
pygame.error: File is not a Windows BMP file

As intended, I can read the gzip.open() stream file as if it was not
compressed with standard file IO stuff but the pygame call appears to
know the difference. Am I doing something wrong or is this a problem
with image.load()?

Thanks,
Paul