CImg: Failed to recognize the jpg format

后端 未结 3 1735
傲寒
傲寒 2021-01-13 14:08
#include 
#include 
#include \"CImg.h\"

using namespace cimg_library;
using namespace std;

int main(){
CImg im         


        
3条回答
  •  一个人的身影
    2021-01-13 14:32

    To enable native JPG file support in CImg, put this before including CImg.h:

    #define cimg_use_jpeg
    #include "CImg.h"
    ....
    

    and link your code with the libjpeg library. It works flawlessly for me. If you don't use this, CImg will try to do an external call to ImageMagick's convert tool to load the file, which is not the cleanest solution. Using libjpeg inside CImg is definitely better. That works the same for other image formats (tiff, png, ...).

提交回复
热议问题