saveimage
This function is used to save image to a file.
void saveimage(
LPCTSTR strFileName,
IMAGE* pImg = NULL
);
Parameters
strFileName
Specifies the file name of the target picture. The picture format is specified by the extension of the file name, and the bmp / gif / jpg / png / tif format is supported. When you save a file, the existing file will be overwritten.
pImg
Specifies A pointer to the source IMAGE object. If NULL, represents the graphics window.
Return Value
None
Examples
The following example saves the contents of the graphics window as "D: \test.bmp":
#include <graphics.h>
#include <conio.h>
int main()
{
// Initialize the graphics window
initgraph(640, 480);
// Draw an image
outtextxy(100, 100, _T("Hello World!"));
// Save a drawn image
saveimage(_T("D:\\test.bmp"));
// Press any key to exit
_getch();
closegraph();
}