开发者

Loading PNGs with CImg

开发者 https://www.devze.com 2023-01-21 19:48 出处:网络
I am unable to load PNGs with CImg. I\'ve heard you need to get libpng / zlib to get to work first but I am unsure how to set this up. I am on Ubuntu. My source:

I am unable to load PNGs with CImg. I've heard you need to get libpng / zlib to get to work first but I am unsure how to set this up. I am on Ubuntu. My source:

#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();
    ret开发者_开发问答urn 0;
}


Close, but you need #define cimg_use_png

and add -lpng to your linker flags.

0

精彩评论

暂无评论...
验证码 换一张
取 消