How to dereference a Blob?

You could use HTTP directly with the espidf module. It’s more efficient because everything is implemented in C (with a Micropython API).
While only HTTP client is currently supported, I believe it should be pretty easy to add HTTP server.
HTTP/2 is also supported (but not documented yet).

Another option is to avoid communicating with the web client directly.
Instead, the device could interact with some service on a remote server with TCP socket (or UDP or any other way), and the service would push the data to the web client.

For preservation I’ve added the screenshot feature to https://github.com/harbaum/LittleBlockly

i need to figure out where that APi is and how it works.

Nah … that requires some seperate service which noone will maintain and in a few months the devices stop working.

Although Websocket and similar might be a little heavy for my simple mpy webserver as this requires ssl/md5 and such. I think using the builtin web server may the way to go.

I fixed the problem on the latest version so the workaround is no longer needed.
Now this should work:

def my_flush(drv, area, buf):
    print('Update %d bytes' % area.get_size())
    global orig_flush
    orig_flush(drv, area, buf)

drv = lv.disp_get_default().driver
orig_flush = drv.flush_cb
drv.flush_cb = my_flush

It’s useful if we want a platform-agnostic “print-screen”, it should work now with any display driver.

Does MicroPython offer a way to generate image files (PNG, etc.)?

We are using the binding script to generate Micropython API for the lodepng library which provides encoding/decoding functions for PNG.
Currently I removed the encoding part to save some program RAM since we are mostly decoding PNG files, but it’s very easy to add it back if we ever want to.

The question is what further path the image takes. If you want it to become a PNG you likely want to export it from the target device. And there are two main paths: SD card and web browser.

In case of the webbrowser there’s imho no reason to do the png encoding on the target device. Instead you can download the raw image like i do now and then use javascript on browser sideo to convert to png like explained at https://stackoverflow.com/questions/923885/capture-html-canvas-as-gif-jpg-png-pdf.

If you download to SD card, then yes, a easy to use image format may be useful if you don’t want to run conversion tools on the PC. But maybe it’s easier to use a potential uncompressed format like tga.

I tried something similar. After reading the first line with the GET request I simply stopped reading/parsing further header fields and just served the page immediately. Interestingly the browsers don’t like that. If you close the connection after sending the reply and before they had a chance to send all their data they complain.

Interesting. What if you let it send the remaining data but ignored it? Or does that slow things down to the point where it doesn’t help?