I have a problem with CImg. I want to convert .bmp file to .jpg one.
#include "CImg.h"
using namespace cimg_library;
(...)
CImg<unsigned char> image("image.bmp");
image.save_jpeg("image.jpg", 60);
When I want to run this program, sometimes it return an error: CImag error
Sometimes it did not appear, but also did not create .jpg file.
I want to add, that another CImg functions works properly, like turning photo to a grayscale.
Could you please tell me what is wrong with this code? Maybe it is another possible way to convert and save photo into .jpg file?
EDIT: When I add
#define cimg_use_jpeg
before
#include <CImg.h>