Skip to content

using width and/or height parameters in .screenshot causes an infinite loop #9

@mcleantom

Description

@mcleantom

I am trying to do a screenshot of a docker container which runs firefox and a vnc, you can run this yourself like:

docker run -p 5900:5900 jlesage/firefox

I then want to take a screenshot and reduce the image size so it hopefully runs faster:

import asyncio, asyncvnc
from PIL import Image


async def get_screenshot():
    host = "localhost"
    port = 5900
    async with asyncvnc.connect(host, port) as client:
        pixels = await client.screenshot(width=320, height=240)
        image  = Image.fromarray(pixels)
        image.save("screenshot.png")


if __name__ == "__main__":
    asyncio.run(get_screenshot())

The code seems to get stuck on an infinite loop somewhere (hard for me to find out where).

On a separate note, what I really want to do is lower the resolution but keep the whole screen size, do you know if this is possible?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions