vncdotool icon indicating copy to clipboard operation
vncdotool copied to clipboard

Get PIL image object directly instead of saving to disk

Open lsd-cat opened this issue 1 year ago • 0 comments

Hello, I would like to get a screen frame as a PIL object instead of directly writing it to disk, so I can pass that to tesseract for OCR. I am trying to figure out what is the best way to do that.

I tried something like:

        vnc_client = api.connect(server="ip:port", timeout=5)
        vnc_client.framebufferUpdateRequest(False)
        vnc_client.screen

However, seeing the backend code it does not seem the best way to do it, and in practice I often get either a black frame or a very old frame, while if I call captureSave it is always the correct frame. I see that is probably caused by the deferred operation, is there a way with the current API to achieve this without having to modify it? otherwise I could just add an extra API call (or an intermediate one that does not save the image but returns it).

vncdotool version

vncdotool 1.2.0

lsd-cat avatar Feb 15 '24 09:02 lsd-cat