[Image-SIG] display image file from buffer

Sangwon Chae blueblud at gmail.com
Thu Nov 16 00:10:31 CET 2006


Hello~

There are a server and client program using socket. The client is connected
to a wireless camera and received frames(jpg format) from the camera. Then,
the client sends it to the server. The server displays them if a frame is
completed received. I'm using pygame for a display part. However, there is a
problem. The packet includes a jpg foramt data and is stored into a buffer,
so I should display them. When I've seen pygame.image module, there is a way
to use a buffer to display such as pygame.image.frombuffer. But, I cannot
use it because it supports raw data but not jpg file format.

Do you have any idea to display buffer(jpg format) immediately? (not to
store file and read it)

Thanks.

>* Arthur Elsenaar wrote:
*>*
*>>* what I like to do, is reading arbitrary images coming in over a socket
*>>* and display them _as they arrive_, so when a chunk is in, immediatly
*>>* display it (in pygame).
*>>*  From the PIL documentation, I can see that one needs to use the
*>>* frombuffer() method and feed that to pygame using the fromstring()
*>>* method. Also I understand the pygame.load() function needs a complete
*>>* file like object (StringIO), so how does one go about partly
*>>* displaying
*>>* these incoming data chunks? Do I need to use the PIL parse function
*>>* somehow? Do I need to pad the missing data?
*>*
*>* while PIL can decode things incrementally, there's no (reliable) way to
*>* get access to incomplete image data.  maybe in 1.1.6 ?
*
hmm, too bad PIL can't do this cleanly. But I'm still interested in
what you mean by 'no reliable'. Can you tell a bit more on what -can-
be done in this respect? As I'm working on an art project, less than
perfect results aren't a problem.



-- 
Sangwon Chae
Ph.d student at Electrical Engineering and Computer Science, UCI
1-949-838-5342
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20061115/3e2561e9/attachment.htm 


More information about the Image-SIG mailing list