(Source: http://blog.bioon.net/user1/2484/archives/2009/233212.shtml
)
I have been using OpenGL for graphics programming in the past. I have heard that it is very convenient to use freeimage for graphics processing. Recently I have learned how to use freeimage for graphics programming. In http://freeimage.sourceforge.net/
Lower
The latest freeimage 3.12.0 [Win32],
Decompress the freeimage3120win32.zip file, and delete the subfolders, freeimage. H, freeimage. Lib, and
Place freeimage. dll in the include folder, lib folder, and bin folder of the VC installation folder. In addition, http://freeimage.sourceforge.net/
You can download the Reference Manual (a free, open source graphics library) written by freeimage on the website. you can also download the Chinese version reference manual translated by Mr. Li pinzhong from the Hunan Earthquake Administration (a Free and Open Source graphic library).
Note that the XXX. cpp or XXX. C of the freeimage library must be used.ProgramTo make the following declaration:
# I nclude "freeimage. H"
# Pragma comment (Lib, "freeimage. lib ")
Bytes -----------------------------------------------------------------------------------------
A simple program is as follows: (reproduced in the park "freeimage learning notes" http://blog.chinaunix.net/u1/58776/showart_527523.html
)
# I nclude <iostream>
# I nclude <cassert>
# I nclude "freeimage. H"
# Pragma comment (Lib, "freeimage. lib ")
# Define show (a) STD: cout <A <STD: Endl
Int main (INT argc, char * argv)
{
// Initialize freeimage
Freeimage_initialise (true );
// By default, a memory is allocated to store images. BPP indicates the image depth.
// Fibitmap * bitmap = freeimage_allocatet (fit_bitmap, width, height, bpp,
// Red_mask, green_mask, blue_mask );
// The last parameter is used to change the function behavior or activate a feature of the bitmap plug-in. Each plug-in has its own parameter set.
// The freeimage_loadu parameters are the same, but they only work under Win32.
Fibitmap * BMP = freeimage_load (fif_bmp, "cs5.bmp", BMP _default );
// Freeimage_saveu is the same as above
If (BMP)
{
// Freeimage_save (pai_bmp, BMP, "whtm.bmp", BMP _default );
}
// Obtain the image width and height in pixels.
Int width = freeimage_getwidth (BMP );
Int Height = freeimage_getheight (BMP );
// Get the byte width of the image. No. The value above is equal to the width.
Int bytewidth = freeimage_getline (BMP );
// Returns the grayscale value for each pixel.
Show (freeimage_getbpp (BMP ));
// Return data type
Show (freeimage_getimagetype (BMP ));
// Returns the size of the palette.
Show (freeimage_getcolorsused (BMP ));
Show (width <""
// Assert (bytewidth = width * 8 );
Show (freeimage_getdibsize (BMP ));
// When there is a call to load, there will be unload, otherwise the memory will leak
Freeimage_unload (BMP );
Freeimage_deinitialise ();
Return 0;
}
(Freeimage is one of the four major image programming libraries (opencv/freeimage/cimg/cximage. Freeimage: a c-language system that ensures high pointer computation speeds. It contains a variety of advanced interpolation methods.Algorithm.
In addition, unique meta EXIF information can be read. The biggest feature of this library is its conciseness. It only focuses on reading and writing images of various formats, but does not display any of them. In actual programming, you still need to call the API function for display.
)
Other materials:
Http://hi.baidu.com/brianlanbo/blog/item/67c85e11c4c9972fdc540142.html