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

#include <IImageWrapper.h>

+ Inheritance diagram for IImageWrapper:

Public Types

using TStringMap = TMap< FString, FString >
 

Public Member Functions

virtual bool SetCompressed (const void *InCompressedData, int64 InCompressedSize)=0
 
virtual bool SetRaw (const void *InRawData, int64 InRawSize, const int32 InWidth, const int32 InHeight, const ERGBFormat InFormat, const int32 InBitDepth, const int32 InBytesPerRow=0)=0
 
virtual bool CanSetRawFormat (const ERGBFormat InFormat, const int32 InBitDepth) const =0
 
virtual ERawImageFormat::Type GetSupportedRawFormat (const ERawImageFormat::Type InFormat) const =0
 
virtual TArray64< uint8GetCompressed (int32 Quality=0)=0
 
virtual TArray64< uint8GetExportData (int32 Quality=0)
 
bool GetRaw (TArray64< uint8 > &OutRawData)
 
bool GetRaw (FDecompressedImageOutput &OutDecompressedImage)
 
bool GetRawImage (FImage &OutImage)
 
bool GetRawImage (FDecompressedImageOutput &OutDecompressedImage)
 
virtual bool GetRaw (const ERGBFormat InFormat, int32 InBitDepth, TArray64< uint8 > &OutRawData)=0
 
virtual bool GetRaw (const ERGBFormat InFormat, int32 InBitDepth, FDecompressedImageOutput &OutDecompressedImage)=0
 
bool GetRaw (const ERGBFormat InFormat, int32 InBitDepth, TArray< uint8 > &OutRawData)
 
bool GetRaw (const ERGBFormat InFormat, int32 InBitDepth, TArrayView64< uint8 > OutRawData)
 
virtual int64 GetWidth () const =0
 
virtual int64 GetHeight () const =0
 
virtual int32 GetBitDepth () const =0
 
virtual ERGBFormat GetFormat () const =0
 
bool GetSRGB () const
 
ERawImageFormat::Type GetClosestRawImageFormat (bool *bIsExactMatch=nullptr) const
 
void SetDebugImageName (const TCHAR *InDebugImageName)
 
virtual bool SupportsMetadata () const =0
 
virtual void AddMetadata (const FString &InKey, const FString &InValue)=0
 
virtual void GetMetadata (TStringMap &OutMetadata) const =0
 
virtual ~IImageWrapper ()
 

Static Public Member Functions

static IMAGEWRAPPER_API void ConvertRawImageFormat (ERawImageFormat::Type RawFormat, ERGBFormat &OutFormat, int &OutBitDepth)
 
static IMAGEWRAPPER_API ERawImageFormat::Type ConvertRGBFormat (ERGBFormat RGBFormat, int BitDepth, bool *bIsExactMatch=nullptr)
 
static IMAGEWRAPPER_API int64 GetRGBFormatBytesPerPel (ERGBFormat RGBFormat, int BitDepth)
 

Protected Attributes

const TCHARDebugImageName = nullptr
 

Detailed Description

Interface for image wrappers.

to Encode: SetRaw() then GetCompressed() to Decode : SetCompressed() then GetRaw()

in general, direct use of the IImageWrapper interface is now discouraged use ImageWrapperModule CompressImage/DecompressImage instead.

Member Typedef Documentation

◆ TStringMap

using IImageWrapper::TStringMap = TMap<FString, FString>

Constructor & Destructor Documentation

◆ ~IImageWrapper()

virtual IImageWrapper::~IImageWrapper ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ AddMetadata()

virtual void IImageWrapper::AddMetadata ( const FString &  InKey,
const FString &  InValue 
)
pure virtual

Adds a key and value to this image's metadata. Will be saved in the image's header and restored when the image is loaded.

Parameters
InKeyMetadata consists of key value pairs.
InValueMetadata consists of key value pairs.

Implemented in FImageWrapperBase, and FHdrImageWrapper.

◆ CanSetRawFormat()

virtual bool IImageWrapper::CanSetRawFormat ( const ERGBFormat  InFormat,
const int32  InBitDepth 
) const
pure virtual

CanSetRawFormat returns true if SetRaw will accept this format

Implemented in FBmpImageWrapper, FDdsImageWrapper, FIcnsImageWrapper, FIcoImageWrapper, FTgaImageWrapper, and FHdrImageWrapper.

◆ ConvertRawImageFormat()

void IImageWrapper::ConvertRawImageFormat ( ERawImageFormat::Type  RawFormat,
ERGBFormat OutFormat,
int &  OutBitDepth 
)
static

◆ ConvertRGBFormat()

ERawImageFormat::Type IImageWrapper::ConvertRGBFormat ( ERGBFormat  RGBFormat,
int  BitDepth,
bool bIsExactMatch = nullptr 
)
static

◆ GetBitDepth()

virtual int32 IImageWrapper::GetBitDepth ( ) const
pure virtual

Gets the bit depth of the image.

Returns
The bit depth per-channel of the image.

Beware several of the old wrappers (BMP,TGA) incorrectly used to return bits per color not per channel they now correctly return per-channel.

Implemented in FImageWrapperBase, and FHdrImageWrapper.

◆ GetClosestRawImageFormat()

ERawImageFormat::Type IImageWrapper::GetClosestRawImageFormat ( bool bIsExactMatch = nullptr) const
inline

◆ GetCompressed()

virtual TArray64< uint8 > IImageWrapper::GetCompressed ( int32  Quality = 0)
pure virtual

Gets the compressed data. (call SetRaw first) (Note: It may consume the data set in the SetCompressed function if it was set before)

Returns
Array of the compressed data. returns empty array on failure

Implemented in FImageWrapperBase, and FHdrImageWrapper.

◆ GetExportData()

virtual TArray64< uint8 > IImageWrapper::GetExportData ( int32  Quality = 0)
inlinevirtual

Gets the data for export. Usually the same thing as GetCompressed.

Returns
Array of the data to export. returns empty array on failure

◆ GetFormat()

virtual ERGBFormat IImageWrapper::GetFormat ( ) const
pure virtual

Gets the format of the image. Theoretically, this is the format it would be best to call GetRaw() with, if you support it.

Returns
The format the image data is in

Implemented in FImageWrapperBase, and FHdrImageWrapper.

◆ GetHeight()

virtual int64 IImageWrapper::GetHeight ( ) const
pure virtual

Gets the height of the image.

Returns
Image height.
See also
GetWidth

Implemented in FImageWrapperBase, and FHdrImageWrapper.

◆ GetMetadata()

virtual void IImageWrapper::GetMetadata ( TStringMap OutMetadata) const
pure virtual

Copies this image's metadata to the caller's map.

Parameters
OutMetadataA copy of this image's metadata.

Implemented in FImageWrapperBase, and FHdrImageWrapper.

◆ GetRaw() [1/6]

virtual bool IImageWrapper::GetRaw ( const ERGBFormat  InFormat,
int32  InBitDepth,
FDecompressedImageOutput OutDecompressedImage 
)
pure virtual

Gets the raw data and meta info (Note: It may consume the data set in the SetRaw function if it was set before)

Parameters
InFormatHow we want to manipulate the RGB data.
InBitDepthThe output bit-depth per channel, normally 8.
OutRawDataWill contain the uncompressed raw data.
OutDecompressedImageWill contain the mip images if available and other metadata.
Returns
true on success, false otherwise.

this is often broken, should only be used with InFormat == GetFormat() DEPRECATED , use GetRaw() with 2 argument or GetRawImage() meta info overload

Implemented in FImageWrapperBase, FHdrImageWrapper, and FHdrImageWrapper.

◆ GetRaw() [2/6]

virtual bool IImageWrapper::GetRaw ( const ERGBFormat  InFormat,
int32  InBitDepth,
TArray64< uint8 > &  OutRawData 
)
pure virtual

Gets the raw data. (Note: It may consume the data set in the SetRaw function if it was set before)

Parameters
InFormatHow we want to manipulate the RGB data.
InBitDepthThe output bit-depth per channel, normally 8.
OutRawDataWill contain the uncompressed raw data.
Returns
true on success, false otherwise.

this is often broken, should only be used with InFormat == GetFormat() DEPRECATED , use GetRaw() with 1 argument or GetRawImage()

Implemented in FIcoImageWrapper, FImageWrapperBase, FHdrImageWrapper, and FHdrImageWrapper.

◆ GetRaw() [3/6]

bool IImageWrapper::GetRaw ( const ERGBFormat  InFormat,
int32  InBitDepth,
TArray< uint8 > &  OutRawData 
)
inline

Gets the raw data in a TArray. Only use this if you're certain that the image is less than 2 GB in size. Prefer using the overload which takes a TArray64 in general. (Note: It may consume the data set in the SetRaw function if it was set before)

Parameters
InFormatHow we want to manipulate the RGB data.
InBitDepthThe output bit-depth per channel, normally 8.
OutRawDataWill contain the uncompressed raw data.
Returns
true on success, false otherwise.

this is often broken, should only be used with InFormat == GetFormat() DEPRECATED , use GetRaw() with 1 argument or GetRawImage()

◆ GetRaw() [4/6]

bool IImageWrapper::GetRaw ( const ERGBFormat  InFormat,
int32  InBitDepth,
TArrayView64< uint8 OutRawData 
)
inline

Get the raw version of the image and write to the array view (Note: It may consume the data set in the SetRaw function if it was set before)

Parameters
InFormatHow we want to manipulate the RGB data.
InBitDepthThe output bit-depth per channel, normally 8.
OutRawDataWill contain the uncompressed raw data.
Returns
true on success, false otherwise.

this is often broken, should only be used with InFormat == GetFormat() DEPRECATED , use GetRaw() with 1 argument or GetRawImage()

◆ GetRaw() [5/6]

bool IImageWrapper::GetRaw ( FDecompressedImageOutput OutDecompressedImage)
inline

GetRaw after SetCompressed fills the raw data in the native format/depth contained in the file along with meta info Do not use the GetRaw() variants that take format/depth arguments.

Parameters
OutRawDataFilled with raw image data.
OutDecompressedImageFilled with mip images and other metadata.

This GetRaw call replaces the variants with format/depth arguments, but prefer GetRawImage instead.

◆ GetRaw() [6/6]

bool IImageWrapper::GetRaw ( TArray64< uint8 > &  OutRawData)
inline

GetRaw after SetCompressed fills the raw data in the native format/depth contained in the file Do not use the GetRaw() variants that take format/depth arguments.

Parameters
OutRawDataFilled with raw image data.

This GetRaw call replaces the variants with format/depth arguments, but prefer GetRawImage instead.

◆ GetRawImage() [1/2]

bool IImageWrapper::GetRawImage ( FDecompressedImageOutput OutDecompressedImage)

Decode the image file data from SetCompressed() into an FImage OutImage is allocated and attributes are filled. Any previous passed-in contents of OutImage are destroyed. OutImage.Format is ignored, a new format is set from the loaded image MetaInfo is filled if applicable

Parameters
OutDecompressedImageImage and meta data along with Mip Map Images

This is the recommended API to get the raw image data from the imagewrapper. Prefer this instead of any of the GetRaw() calls.

◆ GetRawImage() [2/2]

bool IImageWrapper::GetRawImage ( FImage OutImage)

Decode the image file data from SetCompressed() into an FImage OutImage is allocated and attributes are filled Any previous passed-in contents of OutImage are destroyed OutImage.Format is ignored, a new format is set from the loaded image

Parameters
OutImageFilled with the image

This is the recommended API to get the raw image data from the imagewrapper. Prefer this instead of any of the GetRaw() calls.

◆ GetRGBFormatBytesPerPel()

int64 IImageWrapper::GetRGBFormatBytesPerPel ( ERGBFormat  RGBFormat,
int  BitDepth 
)
static

◆ GetSRGB()

bool IImageWrapper::GetSRGB ( ) const
inline

◆ GetSupportedRawFormat()

virtual ERawImageFormat::Type IImageWrapper::GetSupportedRawFormat ( const ERawImageFormat::Type  InFormat) const
pure virtual

returns InFormat if supported, else maps to something supported the returned format will pass CanSetRawFormat()

Implemented in FBmpImageWrapper, FDdsImageWrapper, FIcnsImageWrapper, FIcoImageWrapper, FTgaImageWrapper, and FHdrImageWrapper.

◆ GetWidth()

virtual int64 IImageWrapper::GetWidth ( ) const
pure virtual

Gets the width of the image.

Returns
Image width.
See also
GetHeight

Implemented in FImageWrapperBase, and FHdrImageWrapper.

◆ SetCompressed()

virtual bool IImageWrapper::SetCompressed ( const void InCompressedData,
int64  InCompressedSize 
)
pure virtual

Sets the compressed data. Can then call GetRaw().

Parameters
InCompressedDataThe memory address of the start of the compressed data.
InCompressedSizeThe size of the compressed data parsed.
Returns
true if data was the expected format.

after SetCompressed, image info queries like GetWidth and GetBitDepth are allowed call GetRaw to get the decoded bits decompression is not done until GetRaw

Implemented in FBmpImageWrapper, FDdsImageWrapper, FIcnsImageWrapper, FIcoImageWrapper, FTgaImageWrapper, FImageWrapperBase, and FHdrImageWrapper.

◆ SetDebugImageName()

void IImageWrapper::SetDebugImageName ( const TCHAR InDebugImageName)
inline

◆ SetRaw()

virtual bool IImageWrapper::SetRaw ( const void InRawData,
int64  InRawSize,
const int32  InWidth,
const int32  InHeight,
const ERGBFormat  InFormat,
const int32  InBitDepth,
const int32  InBytesPerRow = 0 
)
pure virtual

Sets the raw image data. Prepares to call GetCompressed() next.

Parameters
InRawDataThe memory address of the start of the raw data.
InRawSizeThe size of the compressed data parsed.
InWidthThe width of the image data.
InHeightthe height of the image data.
InFormatthe format the raw data is in, normally RGBA.
InBitDepththe bit-depth per channel, normally 8.
InBytesPerRowthe number of bytes between rows, 0 = tightly packed rows with no padding.
Returns
true if data was the expected format.

you must not SetRaw() with a format unless it passes CanSetRawFormat() deprecated : avoid direct calls to SetRaw(), use ImageWrapperModule CompressImage instead do not use InBytesPerRow, it is ignored SetRaw does not take gamma information assumes U8 = SRGB and all else = Linear

Implemented in FHdrImageWrapper, FIcnsImageWrapper, and FImageWrapperBase.

◆ SupportsMetadata()

virtual bool IImageWrapper::SupportsMetadata ( ) const
pure virtual

Does this image type support embedded metadata in its header?

PNG is an example of an image type which supports adding user-defined metadata to its header.

Implemented in FImageWrapperBase, and FHdrImageWrapper.

Member Data Documentation

◆ DebugImageName

const TCHAR* IImageWrapper::DebugImageName = nullptr
protected

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