| FreeImage Documentation -Contents Previous Next Up | ||||||||||||||||||||||||||||||||||||||||||||||||||
Simple load functions
SubsectionsFreeImage_LoadBMP
void *FreeImage_LoadBMP(const char *filename, BMPFlags flags = BMP_DEFAULT);
Loads the given Windows Bitmap file or OS/2 Bitmap file into a FreeImage bitmap. If the bitmap is loaded succesfully, memory for it is allocated and a void pointer is returned. If the bitmap couldn't be loaded, FreeImage_LoadBMP returns NULL. BMPFlags defaults to BMP_DEFAULT. No other values exist at this time. Example:
void *dib = FreeImage_LoadBMP("test.bmp"); FreeImage_LoadICO
void *FreeImage_LoadICO(const char *filename, ICOFlags flags = ICO_DEFAULT);
Loads the given Windows ICON file into a FreeImage bitmap. If the icon is loaded succesfully, memory for it is allocated and a void pointer is returned. If the bitmap couldn't be loaded, FreeImage_LoadICO returns NULL. ICOFlags defaults to ICO_DEFAULT. The following parameters can be passed to change the behaviour of the load routine:
Meaning
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
void *dib = FreeImage_LoadICO("test.ico");
void *dib = FreeImage_LoadICO("test.ico", ICO_SECOND); FreeImage_LoadJPEG
void *FreeImage_LoadJPEG(const char *filename, JPEGFlags flags = JPEG_DEFAULT);
Loads the given JPEG or JIF file into a FreeImage bitmap. If the file is loaded succesfully, memory for it is allocated and a void pointer is returned. If the file couldn't be loaded, FreeImage_LoadJPEG returns NULL. JPEGFlags defaults to JPEG_DEFAULT. The following parameters can be passed to change the behaviour of the load routine:
Meaning
Loads the file as fast as possible, sacrifing some quality.
JPEG_ACCURATE
Loads the file as accurate as possible, sacrifcing some speed.
void *dib = FreeImage_LoadJPEG("test.jpg"); void *dib = FreeImage_LoadJPEG("test.jpg", JPEG_ACCURATE); FreeImage_LoadKOALA
void *FreeImage_LoadKOALA(const char *filename, KOALAFlags flags = KOALA_DEFAULT);
Loads the given KOALA file into a FreeImage bitmap. If the file is loaded succesfully, memory for it is allocated and a void 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. KOALAflags defaults to KOALA_DEFAULT. No other values exist at this time. FreeImage_LoadPCD
void *FreeImage_LoadPCD(const char *filename, PCDFlags flags = PCD_DEFAULT);
Loads the given Kodak PhotoCD file into a FreeImage bitmap. If the file is loaded succesfully, memory for it is allocated and a void 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 image exist in one file. By default FreeImage loads the base image. By using the PCDFlags the other image versions can be obtained:
Meaning
24-bit, 768 x 512 pixels
PCD_BASEDIV4
24-bit, 192 x 128 pixels
PCD_BASEDIV16
24-bit. 384 x 256 pixels
void *dib = FreeImage_LoadPCD("test.pcd"); void *dib = FreeImage_LoadPCX("test.pcd", PCD_BASEDIV16); FreeImage_LoadPCX
void *FreeImage_LoadPCX(const char *filename, PCXFlags flags = PCX_DEFAULT);
Loads the given PCX file into a FreeImage bitmap. If the file is loaded succesfully, memory for it is allocated and a void pointer is returned. If the file couldn't be loaded, FreeImage_LoadPCX returns NULL. PCXflags defaults to PCX_DEFAULT. No other values exist at this time. FreeImage_LoadPNM
void *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 succesfully, memory for it is allocated and a void 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 a 8-bit grayscale bitmap type and PPM (Portable Pixelmap format) is a 24-bit full color bitmap. FreeImage automatically detects if you have a PBM, PGM or PPM bitmap and loads it in the default bitdepth of that particular image. PNMflags defaults to PNM_DEFAULT. No other values exist at this time.
void *dib = FreeImage_LoadPNM("test.ppm"); void *dib = FreeImage_LoadPNM("test.pgm"); void *dib = FreeImage_LoadPNM("test.pbm"); FreeImage_LoadPNG
void *FreeImage_LoadPNG(const char *filename, PNGFlags flags = PNG_DEFAULT);
Loads the given PNG file into a FreeImage bitmap. If the file is loaded succesfully, memory for it is allocated and a void pointer is returned. If the file couldn't be loaded, FreeImage_LoadPNG returns NULL. PNGflags defaults to PNG_DEFAULT. No other values exist at this time. FreeImage_LoadRAS
void *FreeImage_LoadRAS(const char *filename, RASFlags flags = RAS_DEFAULT);
Loads the given Sun rasterfile into a FreeImage bitmap. If the file is loaded succesfully, memory for it is allocated and a void pointer is returned. If the file couldn't be loaded, FreeImage_LoadRAS returns NULL. RASflags defaults to RAS_DEFAULT. No other values exist at this time. FreeImage_LoadTARGA
void *FreeImage_LoadTARGA(const char *filename, TARGAFlags flags = TARGA_DEFAULT);
Loads the given TARGA file into a FreeImage bitmap. If the file is loaded succesfully, memory for it is allocated and a void pointer is returned. If the file couldn't be loaded, FreeImage_LoadTARGA returns NULL. TARGAFlags defaults to TARGA_DEFAULT. The following parameters can be passed to change the behaviour of the load routine:
Meaning
If the TARGA file is 32-bit, it is automatically converted to 24-bit.
TARGA_LOAD_RGB555
If the TARGA file is 16-bit, it is not automatically converted to 24-bit
void *dib = FreeImage_LoadTARGA("test.tga"); void *dib = FreeImage_LoadTARGA("test.tga", TARGA_LOAD_RGB888); FreeImage_LoadTIFF
void *FreeImage_LoadTIFF(const char *filename, TIFFFlags flags = TIFF_DEFAULT);
Loads the given TIFF file into a FreeImage bitmap. If the file is loaded succesfully, memory for it is allocated and a void pointer is returned. If the file couldn't be loaded, FreeImage_LoadTIFF returns NULL. TIFFFlags defaults to TIFF_DEFAULT. The following parameters can be passed to change the behaviour of the load routine:
Meaning
void *dib = FreeImage_LoadTIFF("test.tiff");
void *dib = FreeImage_LoadTIFF("test.tiff", TIFF_DIRECTORY1); Copyright 2000 Floris van den Berg (freeimage@wxs.nl) |