1、Linux系统有png和zlib库的支持。
zlib下载地址:http://www.zlib.net/
png下载地址:http://www.libpng.org/pub/png/
2、声明对png的引用。
#define cimg_use_png
#include "CImg.h"
3、保存图片
img.save_png(strNameRight.c_str());
在安装zlib和png之后,要在/etc/ld.so.conf中包含路径/usr/local/lib,并执行ldconfig命令。