Recently in my diploma I need to encode jpeg file on client, after some research I found library created using Alchemy project( from C/C++ language).It allows you to encode jpeg both synchronous and asynchronous with maximum speed(unlike standard encode() method).