There is a variable LPBYTE Buffer , which points to a full-fledged BMP file, obtained as a result of the webcam and the code for the formation of this file from the frame. It is necessary to convert this buffer to another buffer with a jpeg file, directly in memory - the BMP of the hard disk did not touch, and jpeg does not need to do this either.

Please tell me the conversion algorithm, or a chain of GDI + calls (only without reading / writing files).

PS: if you write this BMP (226 Kb) to disk, open it through paint and save as jpg, this jpg will be only 13 Kb - this is what compression is needed. Paint uses GDI +?

  • Actually, instead of writing to a file, you can write to memory :) - Alexander Muksimov
  • I am not particularly familiar with GDI +, and all the examples found on the network demonstrate the conversion when working with files. Do not enlighten? - Iceman
  • Take a ready-made library a la libjpeg . wxWidgets can do this, I think Qt does too. Independently this, I think, is unlikely to work out ... - Harry
  • Libjpeg is great, of course, but first you need to get its static libraries for MinGW, and secondly, the question is how much will the exe shine with static linking? - Iceman
  • And show examples. Surely you can remake a compression in memory. - VladD

0