Libcairo supports several output file formats (PNG, PDF, SVG) and PNG as input format. But often it is necessary to read and write JPG files as well. Libjpeg-turbo does all the JPEG stuff. All you have to do is to combine this with the Cairographics library. I implemented two functions in this small C source …