UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IImageWrapperModule Class Referenceabstract

#include <IImageWrapperModule.h>

+ Inheritance diagram for IImageWrapperModule:

Public Member Functions

virtual bool CompressImage (TArray64< uint8 > &OutData, EImageFormat ToFormat, const FImageView &InImage, int32 Quality=0)=0
 
virtual bool DecompressImage (const void *InCompressedData, int64 InCompressedSize, FImage &OutImage)=0
 
virtual bool DecompressImage (const void *InCompressedData, int64 InCompressedSize, FDecompressedImageOutput &OutDecompressedImage)=0
 
virtual TSharedPtr< IImageWrapperCreateImageWrapper (const EImageFormat InFormat, const TCHAR *InOptionalDebugImageName=nullptr)=0
 
virtual EImageFormat DetectImageFormat (const void *InCompressedData, int64 InCompressedSize)=0
 
virtual EImageFormat GetImageFormatFromExtension (const TCHAR *Name)=0
 
virtual const TCHARGetExtension (EImageFormat Format)=0
 
virtual EImageFormat GetDefaultOutputFormat (ERawImageFormat::Type RawFormat)=0
 
virtual ERawImageFormat::Type ConvertRGBFormat (ERGBFormat Format, int BitDepth, bool *bIsExactMatch=nullptr)=0
 
virtual void ConvertRawImageFormat (ERawImageFormat::Type RawFormat, ERGBFormat &OutFormat, int &OutBitDepth)=0
 
virtual ~IImageWrapperModule ()
 
- Public Member Functions inherited from IModuleInterface
virtual ~IModuleInterface ()
 
virtual void StartupModule ()
 
virtual void PreUnloadCallback ()
 
virtual void PostLoadCallback ()
 
virtual void ShutdownModule ()
 
virtual bool SupportsDynamicReloading ()
 
virtual bool SupportsAutomaticShutdown ()
 
virtual bool IsGameModule () const
 

Detailed Description

Interface for image wrapper modules.

DO NOT WRITE CODE THAT USES IMAPE WRAPPERS DIRECTLY.

If you have "Engine" module, then just use FImageUtils::CompressImage/DecompressImage The easiest way to load/save an image is FImageUtils::LoadImage/SaveImageByExtension

If you don't have "Engine" module, then use IImageWrapperModule::CompressImage/DecompressImage Do not manually create individual image wrappers.

NOTE: Please prefer to work with images through ImageCore FImage/FImageView (not TextureSource/TextureSourceFormat or raw arrays of bytes) again, do not manually use ERGBFormat and arrays of bytes to work with ImageWrappers instead use the FImage-oriented APIs which will handle all format conversions for you.

You do NOT need to convert formats before saving an image, the FImage APIs will do it for you.

If you got an image from a render target, it may have a zero alpha channel. You might want to do FImageCore::SetAlphaOpaque before saving.

note on SRGB/Gamma handling : it is assumed that non-U8 data is always Linear U8 data is written without changing the bytes the gamma correction of U8 bytes is NOT persisted in the file formats (for read or write) loading will always give you SRGB for U8 (ERawImageFormat::GetDefaultGammaSpace) if U8-float conversions are required, they do respect gamma space

eg. if you write U8 Linear data to EXR, it will be converted to Linear float from U8 Linear correctly if you write U8 Linear to BMP , it will write the U8 bytes unchanged, and on load it will come back in as U8 SRGB

Constructor & Destructor Documentation

◆ ~IImageWrapperModule()

virtual IImageWrapperModule::~IImageWrapperModule ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ CompressImage()

virtual bool IImageWrapperModule::CompressImage ( TArray64< uint8 > &  OutData,
EImageFormat  ToFormat,
const FImageView InImage,
int32  Quality = 0 
)
pure virtual

Convert input FImage into a file-format encoded array. in ImageWrapper land, "Compress" means "put in file format" OutData is filled with the file format encoded data lossy conversion of the pixel type may be done if necessary eg. if you pass F32 float pixels to write to BMP, they will be converted to SRGB U8 BGRA8

Parameters
OutDataFilled with image-format data
ToFormatImage format to encode to
InImageImage to encode
Quality50-100 for JPEG, or EImageCompressionQuality

Implemented in FImageWrapperModule.

◆ ConvertRawImageFormat()

virtual void IImageWrapperModule::ConvertRawImageFormat ( ERawImageFormat::Type  RawFormat,
ERGBFormat OutFormat,
int &  OutBitDepth 
)
pure virtual

Convert an FImage ERawImageFormat into an ImageWrapper style {ERGBFormat+BitDepth} mapping is always possible and requires no conversion

Implemented in FImageWrapperModule.

◆ ConvertRGBFormat()

virtual ERawImageFormat::Type IImageWrapperModule::ConvertRGBFormat ( ERGBFormat  Format,
int  BitDepth,
bool bIsExactMatch = nullptr 
)
pure virtual

Implemented in FImageWrapperModule.

◆ CreateImageWrapper()

virtual TSharedPtr< IImageWrapper > IImageWrapperModule::CreateImageWrapper ( const EImageFormat  InFormat,
const TCHAR InOptionalDebugImageName = nullptr 
)
pure virtual

Create an IImageWrapper helper of a specific type

Parameters
InFormat- The type of image we want to deal with
InOptionalDebugImageName- An optional string to be displayed with any errors or warnings
Returns
The helper base class to manage the data EImageFormat is a compressor / file format, not a pixel format Deprecated. Prefer CompressImage/DecompressImage.

Implemented in FImageWrapperModule.

◆ DecompressImage() [1/2]

virtual bool IImageWrapperModule::DecompressImage ( const void InCompressedData,
int64  InCompressedSize,
FDecompressedImageOutput OutDecompressedImage 
)
pure virtual

Implemented in FImageWrapperModule.

◆ DecompressImage() [2/2]

virtual bool IImageWrapperModule::DecompressImage ( const void InCompressedData,
int64  InCompressedSize,
FImage OutImage 
)
pure virtual

Implemented in FImageWrapperModule.

◆ DetectImageFormat()

virtual EImageFormat IImageWrapperModule::DetectImageFormat ( const void InCompressedData,
int64  InCompressedSize 
)
pure virtual

Detect image format by looking at the first few bytes of the compressed image data. You can call this method as soon as you have 8-16 bytes of compressed file content available.

Parameters
InCompressedDataThe raw image header.
InCompressedSizeThe size of InCompressedData.
Returns
the detected format or EImageFormat::Invalid if the method could not detect the image format.

Implemented in FImageWrapperModule.

◆ GetDefaultOutputFormat()

virtual EImageFormat IImageWrapperModule::GetDefaultOutputFormat ( ERawImageFormat::Type  RawFormat)
pure virtual

Implemented in FImageWrapperModule.

◆ GetExtension()

virtual const TCHAR * IImageWrapperModule::GetExtension ( EImageFormat  Format)
pure virtual

Implemented in FImageWrapperModule.

◆ GetImageFormatFromExtension()

virtual EImageFormat IImageWrapperModule::GetImageFormatFromExtension ( const TCHAR Name)
pure virtual

Implemented in FImageWrapperModule.


The documentation for this class was generated from the following file: