saveimage

The function is used to  save the drawing contenttos to the picture file.

void saveimage(
	LPCTSTR strFileName,
	IMAGE* pImg = NULL
);

Parameters

strFileName

Specify the file name. The file name extension represents the saved picture format, which supports the bmp /gif/jpg/png/tif format. Existing files will be overwritten.

pImg

A pointer to the 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();
}