ra1nty / DXcam

A Python high-performance screen capture library for Windows using Desktop Duplication API
MIT License
457 stars 67 forks source link

Go for speed, but need many patches #70

Open AI-M-BOT opened 11 months ago

AI-M-BOT commented 11 months ago

I was not allowed to share this code until now 😞, for any reason why just ask my boss

Modified code is buggy, it might just give an idea how to make DXcam a bit faster. Now yall can do partial screenshot more efficiently.

for shot function usage:

# Of course create a camera first
...
img = np.zeros((cut_h, cut_w, 4), dtype='uint8')
camera.shot(img.ctypes.data_as(c_char_p), region=your_region)
...

For any issues happened we all can discuss and fix them together

Agade09 commented 11 months ago

Thanks for posting this. I used it in a branch of mine but couldn't fork from your fork to keep your commit because your fork is based on mine and we were both working on the main branch, so I just didn't know how. I believe I've fixed your code for !=0 rotation angles and made small performance improvements.

tooichitake commented 6 months ago

Hi, can you check the branch: NewFeatures by Agade09? I found this version is quit faster than other versions, but nobody even mentioned it. As I tested, NewFeatures, grab(), is average 0-1 ms per picture, and what you have provided-Main, with grab() function, is 2-5 ms. Will you check and merge it to this

crackwitz commented 6 months ago

I would recommend reviewing all uses of ctypes.string_at(). That function is meant to be used on C strings, i.e. they stop at the first null byte (0x00). Also it might actually make a copy of the data. There might be better types to use for handling blocks of bytes.