1

I want to capture screenshots of the whole screen and send them using tcp sockets. In python this can be done using PIL

from PIL import Image
im = grab()
im.save(filename)

It is cross-platform and the size of resulting images is mostly less than 500KB. I can't use python because the user may not have python installed and the screenshot utility is a part of a bigger program written is C++ which also handles the networking part. Is it possible to get all these features of the above given code using some C++ library or somehow use the python code as a library for C++?

0

The excellent wxWidgets library as well as providing a full GUI toolkit chain allows you to take screenshots as covered in this SO Question.

wxWidgets is open source, free to use for commercial use and has been running since 1992 but is still under active development.

0

The easy was is to embed python, (and the PIL/Pillow libraries), in your C++ application as described in the documents and shown in the demo Demo/embed/of the source distribution.

Note that you might also wish to do the networking side from Python as the built in libraries make this so much easier than C++ does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.