nothings / single_file_libs

List of single-file C/C++ libraries.
8.95k stars 588 forks source link

Add CImg, C++ Template Image Processing Toolkit #54

Closed jnareb closed 7 years ago

jnareb commented 7 years ago

The CImg Library is a small, open-source, and modern C++ toolkit for image processing. It is made of a single include-only header file CImg.h

http://cimg.eu (https://github.com/dtschump/CImg)

Category: images License: CeCILL-C (close to the GNU LGPL) or CeCILL (compatible with the GNU GPL) API: C++ Files: 1 Description: multi-format image processing and display

#include "CImg.h"
using namespace cimg_library;
int main(void)
{
  CImg<unsigned char> image("lena.jpg");
  image.blur(2.5);
  CImgDisplay main_disp(image,"Lena (blurred)");
  while (!main_disp.is_closed()) {
    main_disp.wait();
  }
  return 0;
}
jnareb commented 7 years ago

Or even simpler example (from http://cimg.eu/CImg_slides.pdf):

#include "CImg.h"
using namespace img_library;
int main(int argc, char **argv) {
    CImg<unsigned char> img(300,200,1,3);
    img.fill(32);
    img.noise(128);
    img.blur(2,0,0);

    const unsigned char white[] = { 255,255,255 };
    img.draw_text("Hello World",80,80,white,0,32);
    img.display();

    return 0;
}
nothings commented 7 years ago

I think 60KLoC is kind of borderline, but I won't reject it for that reason.

It's a little unclear to me what someone is supposed to actually do to choose between the licenses when incorporating the project into their source tree. I wish the author would clarify that, but I'm not going to reject listing it just for that.

So... added!