使用Cimg库读取jpeg图像时出现堆栈溢出错误

当我尝试使用Cimg库读取jpg文件而其他格式bmp正在工作文件时,我收到堆栈溢出错误。

我该如何解决?

  #include"CImg.h" #include using namespace cimg_library; int main() { CImg src("d:\\sidimg.jpg"); int width = src.width(); int height = src.height(); unsigned char* ptr = src.data(0,0); int count=0; while(count!= width*height) { printf("%d",*ptr); ptr++; count++; } } 

对于迟到的答案很抱歉,但是您必须将ImageMagick包中的convert.exe放在与执行程序相同的目录中才能读/写jpeg图像。