CImg的使用: const char *imageIN="image.jpg" const char *imageOUT="imgeout.jpg" CImg<uchar> input_image(imageIN); size_t image_width = input_image.width(); size_t image_height = input_image.height(); size_t channels = input_image.spectrum(); CImg<uchar> output_image(image_width, image_height, input_image.depth(), channels); //create //pout points to some data for(size_t h=0; h<image_height; ++h) for (size_t w=0; w<image_width; ++w) { output_image(w, h, 0, 2) = *pout; //B output_image(w, h, 0, 1) = *(pout+1); //G output_image(w, h, 0, 0) = *(pout+2); //R pout +=3; } output_image.save(imageOUT); //save