gpt4 book ai didi

png - 使用CImg加载PNG

转载 作者:行者123 更新时间:2023-12-04 18:15:43 24 4
gpt4 key购买 nike

我无法使用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
并将-lpng添加到链接器标志。

关于png - 使用CImg加载PNG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4001816/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com