Look at SaveImageToFile for details.
function ImSaveImageToFile(FileName: PAnsiChar; const Image: TImageData): Boolean; cdecl;
ImagingExport (at line 95)