Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting bitmap to jpeg array #89

Open
sujitvasanth opened this issue May 21, 2022 · 0 comments
Open

Converting bitmap to jpeg array #89

sujitvasanth opened this issue May 21, 2022 · 0 comments

Comments

@sujitvasanth
Copy link

sujitvasanth commented May 21, 2022

I am trying to take screenshots and send to home assistant as jpeg.
My solution works but is very inelligent.. please help ..I would like to do without PIL and without the intermediate jpeg file

    screen=autopy.bitmap.capture_screen()
    screen.save("screenshot.jpeg")
    with open("screenshot.jpeg", 'rb') as f:
        filecontent = f.read()
    byteArr = bytearray(filecontent)
    client.publish(topic_screen, byteArr)

Presumably autopy does the jpeg conversion prior to the file save so just wanted to capture the array and not save to file
sincerely Sujit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant