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

Colors are incorrect in screenshot #891

Open
conor-b777 opened this issue Nov 9, 2024 · 0 comments
Open

Colors are incorrect in screenshot #891

conor-b777 opened this issue Nov 9, 2024 · 0 comments

Comments

@conor-b777
Copy link

conor-b777 commented Nov 9, 2024

I'm making a small program that opens a window with a pyautogui.screenshot of their mouses position, constantly.

In this window, the colors seem to be swapped. This happens mainly to orange and blue. This has happened on macOS and windows 10, with a ViewSonic Omni monitor and the Omen 15's display on macOS and Windows 10 respectively.

This is my code:

import cv2
import pyautogui
import numpy

wwidth = 450
wheight = 450
cursorpos = pyautogui.position()

nposx = cursorpos.x - 225
nposy = cursorpos.y - 225

while True == True:
    im = numpy.array(pyautogui.screenshot(region=((nposx, nposy) + (wwidth, wheight))))

    cursorpos = pyautogui.position()
    nposx = cursorpos.x - wwidth/2
    nposy = cursorpos.y - wheight/2

    cv2.imshow("Press Q to kill window", im)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

Any help would be greatly appreciated, and apologies if my code is formatted terribly, I am a beginner to programming in general.

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