Look at FreeImage for details.
function ImFreeImage(var Image: TImageData): Boolean; cdecl;
ImagingExport (at line 52)