-1

I am looking for some python library that is able to convert numpy array to an png image. My requirements are that it should be as fast as possible and output image should be as small as possible and stay in memory (not save on hard drive). I am currently using OpenCv function imencode but it generates big output (i couldnt find a way to set compression level). My application is real-time remote desktop. Workflow is as follows: first it grabs the screen and saves it to numpy array. Then it compares two screens and pixels with same value are blackened [0,0,0,0]. Then i chop image to 128x128 chunks and if there are some non black pixels in current slice i need to convert this slice to png use base64 and send it over websocket. But current solution is giving huge data output. So i am looking for method that can reduce this size but is at least as fast as current solution. As other side of communication accept only base64 png images i am not able to use another techniques.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.