| FreeImage Documentation -Contents Previous Next Up |
Simple save functions
SubsectionsFreeImage_SaveBMP
bool FreeImage_SaveBMP(void *dib, const char *filename, BMPFlags flags = BMP_DEFAULT);
Saves the FreeImage DIB to a Windows Bitmap file. The BMP file is always saved in the Windows format. No compression is used.
void *dib = FreeImage_LoadBMP("test.bmp"); if (dib != NULL) { FreeImage_SaveBMP("saved.bmp"); FreeImage_Free(dib); } FreeImage_SavePNG
bool FreeImage_SavePNG(void *dib, const char *filename, PNGFlags flags = PNG_DEFAULT);
Saves the FreeImage DIB to a PNG file.
void *dib = FreeImage_LoadBMP("test.bmp"); if (dib != NULL) { FreeImage_SavePNG("saved.png"); FreeImage_Free(dib); } FreeImage_SavePNM
bool FreeImage_SavePNM(void *dib, const char *filename, PNMFlags flags = PNM_DEFAULT);
Saves the FreeImage DIB to a PNM file. PNM is a descriptive name for a collection of ASCII based bitmap types: PBM, PGM and PPM. If the bitmap has a bitdepth of 1, the file is saved as a PBM file. If the bitmap has a bitdepth of 8, the file is saved as a PGM file. If the bitmap has a bitdepth of 24, the file is saved as a PPM file. Other bitdepths are not supported.
void *dib = FreeImage_LoadBMP("test.bmp"); if (dib != NULL) { switch(FreeImage_GetBPP(dib)) { case 1 : FreeImage_SavePNM("saved.pbm"); break; case 8 : FreeImage_SavePNM("saved.pgm"); break; case 24 : FreeImage_SavePNM("saved.ppm"); break; } FreeImage_Free(dib); } FreeImage_SaveTIFF
bool FreeImage_SaveTIFF(void *dib, const char *filename, TIFFFlags flags = TIFF_DEFAULT);
Saves the FreeImage DIB to a TIFF file.
void *dib = FreeImage_LoadBMP("test.bmp");
if (dib != NULL) { FreeImage_SaveTIFF("saved.tiff"); FreeImage_Free(dib); } Copyright 2000 Floris van den Berg (freeimage@wxs.nl) |