[libavg-users] Adding images inside a frame handler

Ulrich von Zadow uzadow at libavg.de
Wed Jan 6 14:12:13 CET 2010


On Jan 6, 2010, at 12:22 PM, Alex Harrington wrote:

>> There's a bitmap constructor that takes a point, a pixel format and a
>> string, in that order.
>
> Sorry. I'm probably being dense but here's what I have now:
>
>        image = Image.open(os.path.join('data',self.options['uri']))
>        image.thumbnail((self.width,self.height),Image.ANTIALIAS)
>
>        point = avg.Point2D(0,0)
>        bitmap = avg.Bitmap(point,"B5G6R5",image.tostring())
>      	self.p.enqueue('setBitmap',(self.mediaNodeName, bitmap))
>
> I'm really not sure what pixel format I should be putting in? PIL  
> just says it's in RAW format? Also what is the point argument? I  
> guessed at Point2D but the exception I get when running that  
> suggests it might just be an int?


Sorry - I just checked: a) the syntax is different and b) there's a  
bug that I just fixed that prevents it from working.

So, after an svn update, something similar to this should work:

             bmp = avg.Bitmap(IntPoint(64, 64), avg.R8G8B8X8,  
"ImageName")
             bmp.setPixels(s)

Cheers,

   Uli

--
Any technology distinguishable from magic is insufficiently advanced.

Ulrich von Zadow | +49-172-7872715
Jabber: coder at c-base.org
Skype: uzadow






More information about the libavg-users mailing list