title: Convert IplImage into a JPEG without using CvSaveImage in OpenCV
body: <p>I wish to convert an IplImage into a JPEG image in the memory (in order to stream it as M-JPEG frame over sockets) . 
  I know I can use CvSaveImage for this, that creates a jpeg file, I read it again and then stream it over the network.
  I wish to avoid this extra disk write-read ops for faster operation. Any insights ?</p>