[Image-SIG] Getting information from Flash to PIL

Frederico Leonardo phred78 at gmail.com
Thu Dec 11 19:25:17 CET 2008


Hi all,

I've only recently started using Python via Django and so far I'm loving it.
I have a question that hopefully someone might be able to answer. I've
scouted the internet looking for this but can't manage to find the
right example.

I'm creating an e-card application in Django. Some of the e-cards are
SWF with a script that reads your webcam and then produces a new card
with the webcam information. Flash is working fine and it's sending me
variables to construct the new image. I can already get the width and
height:

card_width = int(request.POST.get('width',''))
card_height = int(request.POST.get('height',''))

But I have no idea how to convert the rest of the information into an
image, let alone draw and save it.

This is what Flash is sending me via 'POST':

Variable: px19	
Value: u',,,,,,,,,,,,,,,,,,,,,,,,,,,,,eeffff,abcae7,8baece,6c90b0,6b8faf,698bae,6789ae,(...)

It repeats this for every px# and is also sending me rows and cols,
besides the width and height. Those values are hex and I suppose that
they correspond to the rows, each color being 1 pixel per column.
I came across this technique here:
http://www.sephiroth.it/tutorials/flashPHP/print_screen/page002.php
But alas, it's a PHP script, that I would very much love to reproduce using PIL.

How can I grab that information into an array and then have PIL
convert it into a JPG that I can save on the server. Any ideas?

Thank you!

— Frederico


More information about the Image-SIG mailing list