image compression with MozJPEG: using a memory buffer instead of a file stream

MozJPEG's API is built around the concept of destination and source managers. As their respective name implies, destination and source managers tell MozJPEG where to read/write data before/after compression. The default ones are jpeg_stdio_src/jpeg_stdio_dest which read/write data from a file stream, but there is also the jpeg_mem_src/jpeg_mem_dest.

A walkthrough progressive JPEGs

Although JPEG is an image format that has almost 30 years now, it is still shining. One interesting feature or innovation about the format, which not known to many, is the possiblity to make the loading of the image progressive. This means that the rendering of the image is done gradually by going through scans where each scan contains a certain amount of image data.