我无法使用 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;
}
关闭,但你需要#define cimg_use_png
and add -lpng
到你的链接器标志。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)