Look at SaveMultiImageToMemory for details.
function ImSaveMultiImageToMemory(Ext: PAnsiChar; Data: Pointer; Size: PLongInt; ImageList: TImageDataList): Boolean; cdecl;
ImagingExport (at line 102)