hello, The script below is a prototype for loading playing card images from the bitmap resource in cards.dll (WinXP)
I like the idea of not keeping copies of the images as files. I'm able to extract the card images as files, then load them in pygame as a surface, but I keep getting errors when directly loading the image as string. The call below never works, what I'm I doing wrong? gm.image.fromstring() I tried to use PIL too, but I can't tell yet if pygame will accept the image string from PIL. # begin python import win32api as wi import string as st import pygame as gm import Image as im hnd = wi.LoadLibrary("c:/winnt/system32/cards.dll") # this header works for 71x96x1BPP image # must be one line header = [ chr(0x42), chr(0x4D), chr(0xDE), chr(0x0D), chr(0x00), chr(0x00), chr(0x00), chr(0x00), chr(0x00), chr(0x00), chr(0x4A), chr(0x00), chr(0x00), chr(0x00)] #sheader = ''.join([ chr(header[x]) for x in range(len(header))]) str = wi.LoadResource( hnd, 2, 11, 1033) fp = open( "e:/batch/python/aceclub.bmp", "wt") str = st.join(header,'') + str fp.write( str) fp.close () wi.FreeLibrary(hnd) print len(str) # gives: ValueError: String length does not equal format and resolution size img = gm.image.fromstring(str,(71,96),"P") #print img.mode #fp = open("e:/batch/msdn/Bitmap_11.bmp", "rb") obj = gm.image.load("e:/batch/python/aceclub.bmp") print obj.get_rect() -- http://mail.python.org/mailman/listinfo/python-list