Simple load functions

Subsections

FreeImage_LoadBMP

FIBITMAP *FreeImage_LoadBMP(const char *filename, int flags = BMP_DEFAULT);

Loads the given Windows Bitmap file or OS/2 Bitmap file into a FreeImage bitmap. If the bitmap is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the bitmap couldn't be loaded, FreeImage_LoadBMP returns NULL.

FIBITMAP *dib = FreeImage_LoadBMP("test.bmp");

FreeImage_LoadICO

FIBITMAP *FreeImage_LoadICO(const char *filename, int flags = ICO_DEFAULT);

Loads the given Windows ICON file into a FreeImage bitmap. If the icon is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the bitmap couldn't be loaded, FreeImage_LoadICO returns NULL.

Flags defaults to ICO_DEFAULT. The following parameters can be passed to change the behaviour of the load routine:

FIBITMAP *dib = FreeImage_LoadICO("test.ico");
FIBITMAP *dib = FreeImage_LoadICO("test.ico", ICO_SECOND);

Value Meaning
ICO_FIRST Loads the first icon in the cabinet
ICO_SECOND Loads the second icon in the cabinet
ICO_THIRD Loads the third icon in the cabinet

FreeImage_LoadJPEG

FIBITMAP *FreeImage_LoadJPEG(const char *filename, int flags = JPEG_DEFAULT);

Loads the given JPEG or JIF file into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadJPEG returns NULL.

Flags defaults to JPEG_DEFAULT. The following parameters can be passed to the flags parameter to change the behaviour of the load routine:

FIBITMAP *dib = FreeImage_LoadJPEG("test.jpg");
FIBITMAP *dib = FreeImage_LoadJPEG("test.jpg", JPEG_ACCURATE);

Value Meaning
JPEG_FAST Loads the file as fast as possible, sacrificing some quality.
JPEG_ACCURATE Loads the file as accurate as possible, sacrificing some speed.

FreeImage_LoadKOALA

FIBITMAP *FreeImage_LoadKOALA(const char *filename, int flags = KOALA_DEFAULT);

Loads the given KOALA file into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadKOALA returns NULL

KOALA is a 4-bit bitmap format developed for and supported by ancient commodore 64 computers and emulators. The format is supported for nostalgic reasons of the author.

FIBITMAP *dib = FreeImage_LoadKOALA("test.koa");

FreeImage_LoadLBM

FIBITMAP *FreeImage_LoadLBM(const char *filename, int flags = LBM_DEFAULT);

Loads the given Deluxe Paint LBM file into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadLBM returns NULL

FreeImage_LoadMNG

FIBITMAP *FreeImage_LoadMNG(const char *filename, int flags = MNG_DEFAULT);

Loads the given Multi Network Graphics (MNG) or JPEG Network Graphics (JNG) file into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadMNG returns NULL

FreeImage_LoadPCD

FIBITMAP *FreeImage_LoadPCD(const char *filename, int flags = PCD_DEFAULT);

Loads the given Kodak PhotoCD file into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadPCD returns NULL.

PhotoCD images are so called cabinet files, where several versions of the same bitmap exist in one file. By default FreeImage loads the image marked in the flags as PCD_BASE. By using the flags parameter other image versions can be obtained:

FIBITMAP *dib = FreeImage_LoadPCD("test.pcd");
FIBITMAP *dib = FreeImage_LoadPCX("test.pcd", PCD_BASEDIV16);

Value Meaning
PCD_BASE 24-bit, 768 x 512 pixels
PCD_BASEDIV4 24-bit, 192 x 128 pixels
PCD_BASEDIV16 24-bit. 384 x 256 pixels

FreeImage_LoadPCX

FIBITMAP *FreeImage_LoadPCX(const char *filename, int flags = PCX_DEFAULT);

Loads the given PCX file into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadPCX returns NULL.

FIBITMAP *dib = FreeImage_LoadPCX("test.pcx");

FreeImage_LoadPNM

FIBITMAP *FreeImage_LoadPNM(const char *filename, PNMFlags flags = PNM_DEFAULT);

Loads one of the PNM supported bitmap files into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadPNM returns NULL.

PNM is a descriptive name for a collection of ASCII based bitmap types: PBM, PGM and PPM. PBM (Portable Bitmap format) is a 1-bit, black and white bitmap type, PGM (Portable Greymap format) is an 8-bit greyscale bitmap type and PPM (Portable Pixelmap format) is a 24-bit full colour bitmap. FreeImage automatically detects if you are dealing with a PBM, PGM or PPM bitmap and will load it in the default bit depth of that particular image.

FIBITMAP *dib = FreeImage_LoadPNM("test.ppm");
FIBITMAP *dib = FreeImage_LoadPNM("test.pgm");
FIBITMAP *dib = FreeImage_LoadPNM("test.pbm");

FreeImage_LoadPNG

FIBITMAP *FreeImage_LoadPNG(const char *filename, int flags = PNG_DEFAULT);

Loads the given PNG file into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadPNG returns NULL.

FIBITMAP *dib = FreeImage_LoadPNG("test.png");

FreeImage_LoadRAS

FIBITMAP *FreeImage_LoadRAS(const char *filename, int flags = RAS_DEFAULT);

Loads the given Sun rasterfile into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadRAS returns NULL.

FIBITMAP *dib = FreeImage_LoadRAS("test.ras");

FreeImage_LoadTARGA

FIBITMAP *FreeImage_LoadTARGA(const char *filename, int flags = TARGA_DEFAULT);

Loads the given TARGA file into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadTARGA returns NULL.

Flags defaults to TARGA_DEFAULT. The flags parameter can be passed the following values to change the behaviour of the load plugin:

FIBITMAP *dib = FreeImage_LoadTARGA("test.tga");
FIBITMAP *dib = FreeImage_LoadTARGA("test.tga", TARGA_LOAD_RGB888);

Value Meaning
TARGA_LOAD_RGB888 If the TARGA file is 16 or 32-bit, it is automatically converted to 24-bit.

FreeImage_LoadTIFF

FIBITMAP *FreeImage_LoadTIFF(const char *filename, int flags = TIFF_DEFAULT);

Loads the given TIFF file into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadTIFF returns NULL.

FIBITMAP *dib = FreeImage_LoadTIFF("test.tiff");

FreeImage_LoadWBMP

FIBITMAP *FreeImage_LoadWBMP(const char *filename, int flags = WBMP_DEFAULT);

Loads the given WBMP or WAP file into a FreeImage bitmap. If the file is loaded successfully, memory for it is allocated and a bitmap pointer is returned. If the file couldn't be loaded, FreeImage_LoadWBMP returns NULL.