Draw a simple png image from C ++

I want to create a png image from my C ++ program (and save it to disk). I need only the most basic operations, such as drawing a line, drawing a circle, filling a rectangle, filling a circle, etc. I want to use a very small (ideally 1 header and 1 source file) and a library for developers, which is an open source and cross platform (requires Windows and Unix).

I found PNGwriter, but it does not compile for me on Ubuntu 12.04 with g ++ 4.6.3 (binding problem) and requires the installation of many other libraries.

What is the smallest library that meets these basic requirements?

+4
source share
3 answers

I would say: the CImg library ( http://cimg.sourceforge.net ) looks like the perfect library for you. This is only one header file and is template based (but not by much). Very easy to use and has methods like draw_line (), draw_circle (), etc.

+4
source

Maybe you want to use this library:

http://www.antigrain.com/ 
+1
source

OpenCV http://docs.opencv.org/index.html also offers a basic drawing. This may not be the smallest library, but it is widely used for image processing and is well supported for windows and Linux.

+1
source

All Articles