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 file. Most of the code is derived by the online code example of libjpeg and I modified it to fit into the Cairographics world.
Look at the comments in the source code for further information and have phun using it. Don’t hesitate to contact me!
- 2016/01/01: Code updated.
- 2015/12/29: Code updated.