Reputation: 1
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!
Upvotes: 0
Views: 46