"Greg Krohn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > tlviewer wrote: > > hello, > > hi > > > fp = open( "e:/batch/python/aceclub.bmp", "wt") > > wt? Should this be wb? > > > # gives: ValueError: String length does not equal format and resolution size > > img = gm.image.fromstring(str,(71,96),"P") > > The pygame docs say "P" is for 8bit pallete indices. When I look at the > properties of aceclub.bmp, Windows says it's Bit Depth is 4. I'm not sure if > they're talking about the same thing, though. If so, you could probably use PIL > to convert the depth.
Yes, that was the trouble. Based on your suggestion, I now massage the image string with PIL, then fromstring() works! obj =Image.open(StringIO.StringIO(str)) #obj.convert( mode='P') # conversion is implicit, mode is 'P' already img = gm.image.fromstring(obj.tostring(),(71,96),"P") Next I'm going to load all 53 card resources into a list (array) of strings, then write it out, pickled. That should smooth out loading the game when I use 4-6 decks (Blackjack-21). thanks for getting to my post so quickly, tlviewer -- -- http://mail.python.org/mailman/listinfo/python-list