我无法使用CImg加载PNG。我听说你需要先获取libpng / zlib才能开始工作,但我不确定如何设置。我在Ubuntu上。我的消息来源:
#include <cmath>
#include <cstdio>
#include <string>
#include <assert.h>
#include <stdarg.h>
#define cimg_using_png
#include "CImg.h"
using namespace cimg_library;
#include "png.h"
int main(int argc, char** argv)
{
CImg<unsigned char> img2("test.png");
img2.display();
return 0;
}发布于 2011-01-16 23:42:22
很接近,但您需要#define cimg_use_png
并将-lpng添加到链接器标志。
https://stackoverflow.com/questions/4001816
复制相似问题