0

Here is the code:

    bool bLoaded = false;
    FreeImage_Initialise();
    FIBITMAP* img = FreeImage_Load(FIF_PNG, "imageSave.png", 0);
    FreeImage_Unload(img);
    FreeImage_DeInitialise();


    int  w, h;
    //cr = cairo_create(image);
    cairo_surface_t *image = cairo_image_surface_create_from_png("/root/test1/FreeImage/imageSave.png");
    w = cairo_image_surface_get_width(image);
    h = cairo_image_surface_get_height(image);
    cout << "width " << w << " height " << h;

    cairo_surface_write_to_png(image, "image2.png");
    cairo_surface_destroy(image);

When I use FreeImage, the output of width and heigt is always 0, but when I comment this 4 line, the cairo works

    FreeImage_Initialise();
    FIBITMAP* img = FreeImage_Load(FIF_PNG, "imageSave.png", 0);
    FreeImage_Unload(img);
    FreeImage_DeInitialise();

How can I use this both library? Please help!

quang le
  • 1
  • 1
  • Hello quang le, welcome to StackOverflow for your first post. What is your question ? Because I see 3 questions ! Can you be more explicit ? What happens if you try to open 2 distincts images ? What happens if you begin to work with Cairo library ? – schlebe Sep 11 '20 at 05:39
  • My question is how can I use FreeImage library with cairo library ? Because if I add 4 line of FreeImage library, the cairo library does not work. This problem is not relate to which image I loaded – quang le Sep 11 '20 at 07:31

0 Answers0