[Image-SIG] Example Code for Displaying Pictures--I'm Stumped

Wayne Watson sierra_mtnview at sbcglobal.net
Mon Nov 30 19:51:14 CET 2009


I now have a detailed description of the file, but the smallest file I 
can find is 1.7M. I don't think I can go lower. It probably contains 90 
128x128 frames plus the 640x480. I suppose if there's some tool in Win, 
I could just cut it at some place to shorten it. Tomorrow I'm going out 
of town, but should be on the web mail. I'll have my laptop, and many of 
these files are on it, so I might be able to do some work on this.

Wayne Watson wrote:
> Thanks. I'll try to follow up on this soon.
>
> Bill Janssen wrote:
>> Another good option is pyglet.  I use it for converting video to streams
>> of PIL images.
>>
>> Here's the code for turning a pyglet image into a PIL image:
>>
>>     def pyglet_to_pil_image (pyglet_image):
>>         image = pyglet_image.get_image_data()
>>         format = image.format
>>         if format != 'RGB':
>>             # Only save in RGB or RGBA formats.
>>             format = 'RGBA'
>>         pitch = -(image.width * len(format))
>>
>>         # Note: Don't try and use frombuffer(..); different versions of
>>         # PIL will orient the image differently.
>>         pil_image = Image.fromstring(
>>             format, (image.width, image.height), 
>> image.get_data(format, pitch))
>>         # need to flip the image to accommodate Pyglet's transform space
>>         pil_image = pil_image.transpose(Image.FLIP_TOP_BOTTOM)
>>         return pil_image
>>
>> This code is part of extensions/video.py, part of the UpLib source code
>> at http://uplib.parc.com/.
>>
>> Bill
>>
>>   
>

-- 
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet  
                
          The popular press and many authorities believe the number
          of pedifiles that prowl the web is 50,00. There are no
          figures that support this. The number of children below
          18 years of age kidnapped by strangers is 1 in 600,00,
          or 115 per year. -- The Science of Fear by D. Gardner
 
                    Web Page: <www.speckledwithstars.net/>



More information about the Image-SIG mailing list