[racket] slideshow/pict and HTTP

From: Galler (lzgaller at optonline.net)
Date: Sat Aug 25 21:28:49 EDT 2012

Robby and Matt,

I found one could very easily use the pict library to create bitmaps and 
disseminate over HTTP as png-encoded binary streams

Which is really quite nice.

Thanks much for your work. The 2006 paper is very clear.

  Recursively defined picts structures are powerful abstractions

;STEP 1: Convert PICT to Bitmap

(define x (pict->bitmap (cloud 100 50)))

;STEP 2: convert bitmap to png bytes. and base 64-encode them

(define png (base64-encode (convert x 'png-bytes)))

;STEP 3: send bytes across network

(printf "<html><body><img src='data:image/png;base64,\n
~A' alt='png failed to display' /></body></html>" png)



Posted on the users mailing list.