in src/rosbridge/fetch_proxy.py [0:0]
def image_compress_main(self):
while True:
channel, data = self.image_queue.get()
if 0: print 'len(data.data)=%d data.width=%d data.height=%d' % (len(data.data), data.width, data.height)
im = PIL.Image.frombytes('RGB', (data.width, data.height), data.data, 'raw')
jpeg_writer = StringIO()
im.save(jpeg_writer, 'jpeg')
im_url = 'data:image/jpeg;base64,' + base64.b64encode(jpeg_writer.getvalue())
with self.timeseq_mutex:
if self.timeseq:
self.timeseq.add(data.header.stamp.to_sec(), channel, {
'__type': 'VideoFrame',
'url': im_url,
})