/Engine/Source/Runtime/Engine/Public/ImageUtils.h
"Compress" an image to a file format. Here "Compress" really means put an image into file format binary. Extension is used to identify file format, eg. png/jpeg/etc.FImageViewcan be made from any surface pointer.
static bool CompressImage ( TArray64< uint8 > & OutData, const TCHAR * ToFormatExtension, const [FImageView](API\Runtime\ImageCore\FImageView) & InImage, int32 Quality )