Have you tried using the conversion directly inside the tostring function?
im = open("test.bmp") imdata = im.tostring("raw", "RGBA", 0, -1) w, h = im.size[0], im.size[1] glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, imdata)
Use the compatibility version as an alternative:
try: data = im.tostring("raw", "BGRA") except SystemError:
source share