Stack overflow error when reading jpeg image using

2019-06-06 01:15发布

问题:

I'm getting stack overflow error when I'm trying to read jpg file using Cimg library while other format bmp is working file .

How can i resolve it?

    #include"CImg.h"
    #include<stdio.h>
    using namespace cimg_library;
    int main()
    {
            CImg<unsigned char> 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++;
                }
   }

回答1:

Sorry for the late answer, but you have to have convert.exe from the ImageMagick package in the same directory as where the program is executing in order to read/write jpeg images.