UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FImageCore Namespace Reference

Classes

struct  stbir_kernel_and_support
 

Enumerations

enum class  EResizeImageFilter : uint32 {
  Default = 0 , PointSample , Box , Triangle ,
  Bilinear = Triangle , CubicGaussian , CubicSharp , CubicMitchell ,
  AdaptiveSharp , AdaptiveSmooth , MitchellOneQuarter , MitchellOneSixth ,
  MitchellNegOneSixth , MitchellNegOneThird , Lanczos4 , Lanczos5 ,
  WithoutFlagsMask = 63 , Flag_WrapX = 64 , Flag_WrapY = 128 , Flag_AlphaWeighted = 256
}
 
enum class  ProcessLinearPixelsAction { ReadOnly , Modified }
 

Functions

IMAGECORE_API void CopyImage (const FImageView &SrcImage, const FImageView &DestImage)
 
IMAGECORE_API void CopyImageRGBABGRA (const FImageView &SrcImage, const FImageView &DestImage)
 
IMAGECORE_API void CopyImageTo2U16 (const FImageView &SrcImage, const FImageView &DestImage)
 
IMAGECORE_API void TransposeImageRGBABGRA (const FImageView &Image)
 
IMAGECORE_API void SanitizeFloat16AndSetAlphaOpaqueForBC6H (const FImageView &InOutImage)
 
IMAGECORE_API bool DetectAlphaChannel (const FImageView &InImage)
 
IMAGECORE_API void SetAlphaOpaque (const FImageView &InImage)
 
IMAGECORE_API void ResizeTo (const FImageView &SourceImage, FImage &DestImage, int32 DestSizeX, int32 DestSizeY, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace)
 
IMAGECORE_API void ComputeChannelLinearMinMax (const FImageView &InImage, FLinearColor &OutMin, FLinearColor &OutMax)
 
IMAGECORE_API bool ScaleChannelsSoMinMaxIsInZeroToOne (const FImageView &ImageToModify)
 
IMAGECORE_API FLinearColor ComputeImageLinearAverage (const FImageView &Image)
 
IMAGECORE_API void TransformToWorkingColorSpace (const FImageView &InLinearImage, const FVector2d &SourceRedChromaticity, const FVector2d &SourceGreenChromaticity, const FVector2d &SourceBlueChromaticity, const FVector2d &SourceWhiteChromaticity, UE::Color::EChromaticAdaptationMethod Method, double EqualityTolerance=1.e-7)
 
 ENUM_CLASS_FLAGS (EResizeImageFilter)
 
IMAGECORE_API void ResizeImage (const FImageView &SourceImage, const FImageView &DestImage, EResizeImageFilter Filter=EResizeImageFilter::Default)
 
IMAGECORE_API void ResizeImageAllocDest (const FImageView &SourceImage, FImage &DestImage, int32 DestSizeX, int32 DestSizeY, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace, EResizeImageFilter Filter=EResizeImageFilter::Default)
 
IMAGECORE_API void ResizeImageAllocDest (const FImageView &SourceImage, FImage &DestImage, int32 DestSizeX, int32 DestSizeY, EResizeImageFilter Filter=EResizeImageFilter::Default)
 
IMAGECORE_API void ResizeImageInPlace (FImage &Image, int32 DestSizeX, int32 DestSizeY, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace, EResizeImageFilter Filter=EResizeImageFilter::Default)
 
IMAGECORE_API void ResizeImageInPlace (FImage &Image, int32 DestSizeX, int32 DestSizeY, EResizeImageFilter Filter=EResizeImageFilter::Default)
 
int64 ImageParallelForComputeNumRows (const FImageView &Image)
 
FImageView ImageParallelForGetOneRowView (const FImageView &Image, int64 Y)
 
IMAGECORE_API int32 ImageParallelForComputeNumJobs (const FImageView &Image, int64 *pRowsPerJob)
 
IMAGECORE_API int64 ImageParallelForMakePart (FImageView *Part, const FImageView &Whole, int64 JobIndex, int64 RowsPerJob)
 
template<typename Lambda >
void ImageParallelFor (const TCHAR *DebugName, const FImageView &Image, const Lambda &Func)
 
template<typename Lambda >
void ProcessLinearPixels (const FImageView &Image, const Lambda &Func, int64 StartY)
 
template<typename Lambda >
void ImageParallelProcessLinearPixels (const TCHAR *DebugName, const FImageView &Image, const Lambda &Func)
 

Detailed Description

The easy and efficient way to write a pixel processing loop that supports all pixel formats is to use

ImageParallelProcessLinearPixels

passing in a lambda like : ProcessLinearPixelsAction ProcessPixels(TArrayView64<FLinearColor> Colors)

this will let you visit all the pixels as FLinearColor.

You can use this for read (return ProcessLinearPixelsAction::ReadOnly) or read-write (return ProcessLinearPixelsAction::Modified).

Enumeration Type Documentation

◆ EResizeImageFilter

Enumerator
Default 
PointSample 
Box 
Triangle 
Bilinear 
CubicGaussian 
CubicSharp 
CubicMitchell 
AdaptiveSharp 
AdaptiveSmooth 
MitchellOneQuarter 
MitchellOneSixth 
MitchellNegOneSixth 
MitchellNegOneThird 
Lanczos4 
Lanczos5 
WithoutFlagsMask 
Flag_WrapX 
Flag_WrapY 
Flag_AlphaWeighted 

◆ ProcessLinearPixelsAction

Enumerator
ReadOnly 
Modified 

Function Documentation

◆ ComputeChannelLinearMinMax()

void FImageCore::ComputeChannelLinearMinMax ( const FImageView InImage,
FLinearColor OutMin,
FLinearColor OutMax 
)

Compute the min/max of each channel to get value ranges Colors are converted to float Linear Gamma

Parameters
InImage- The image to scan
OutMin- filled with the minimum of the color channels
OutMax- filled with the maximum of the color channels

Design:

FImage pixels are dense, so we just treat them as a bunch of samples of U8 or U16. (no need to look at width/height/slices at all).

We ignore the pixel format other than knowing it is a U8 or U16 channel. We always work on 16-byte pieces, which can be varying number of pixels.

Cut the data into pieces for parallel processing (16-byte aligned). Find the 16-byte vector min/max on those pieces. Then gather min/max of the 16-bytes from each piece.

For the tail portion that may not be a full 16 bytes, we can just replicate a pixel to fill 16 bytes and use the same 16-byte aligned min/max routines, so no special tail case is required.

Finally once we have the 16-byte min/max of the whole image, we run the Generic fallback which does the horizontal min/max inside that vector, and also handles correctly interpreting whether it is 16xG8 or 4xBGRA8 or whatever.

◆ ComputeImageLinearAverage()

IMAGECORE_API FLinearColor FImageCore::ComputeImageLinearAverage ( const FImageView Image)

ComputeImageLinearAverage compute the average linear color of the image image can be any pixel format parallel processing is used, but the result is not machine-dependent

◆ CopyImage()

IMAGECORE_API void FImageCore::CopyImage ( const FImageView SrcImage,
const FImageView DestImage 
)

Copy FImageView data, converting pixels if necessary. Sizes must match. Dest must already be allocated. For a function that allocates Dest, use CopyTo().

Because FImage implicitly convers to FImageView, these functions can be used on FImage types as well.

Parameters
SrcImage- The source image to copy from.
DestImage- The destination image to copy to. (the FImageView is const but what it points at is not)

Copies an image accounting for format differences. Sizes must match.

Parameters
SrcImage- The source image to copy from.
DestImage- The destination image to copy to.

◆ CopyImageRGBABGRA()

IMAGECORE_API void FImageCore::CopyImageRGBABGRA ( const FImageView SrcImage,
const FImageView DestImage 
)

Copy Image, swapping RB, SrcImage must be BGRA8 or RGBA16. Sizes must match. Dest must already be allocated. Src == Dest is okay for in-place transpose.

Parameters
SrcImage- The source image to copy from.
DestImage- The destination image to copy to. (the FImageView is const but what it points at is not)

◆ CopyImageTo2U16()

IMAGECORE_API void FImageCore::CopyImageTo2U16 ( const FImageView SrcImage,
const FImageView DestImage 
)

Copy Image to 2xU16 ; Dest Image should be allocated as BGRA8 but is actually 2xU16 Sizes must match. Dest must already be allocated.

Parameters
SrcImage- The source image to copy from.
DestImage- The destination image to copy to. (the FImageView is const but what it points at is not)

◆ DetectAlphaChannel()

bool FImageCore::DetectAlphaChannel ( const FImageView InImage)

Detects whether or not the image contains an alpha channel where at least one texel is != 255.

Parameters
InImage- The image to look for alpha in.
Returns
True if the image both supports and uses the alpha channel. False otherwise.

◆ ENUM_CLASS_FLAGS()

FImageCore::ENUM_CLASS_FLAGS ( EResizeImageFilter  )

◆ ImageParallelFor()

template<typename Lambda >
void FImageCore::ImageParallelFor ( const TCHAR DebugName,
const FImageView Image,
const Lambda &  Func 
)
inline

◆ ImageParallelForComputeNumJobs()

IMAGECORE_API int32 FImageCore::ImageParallelForComputeNumJobs ( const FImageView Image,
int64 pRowsPerJob 
)

FImage is tight packed in memory with slices adjacent to each other so we can just treat it was a 2d image with Height *= NumSlices

eg. make "ImagePart" of 16384 pixels, and make "Rows" for the FLinearColor pass that are always exactly 512 pixels

◆ ImageParallelForComputeNumRows()

int64 FImageCore::ImageParallelForComputeNumRows ( const FImageView Image)
inline

◆ ImageParallelForGetOneRowView()

FImageView FImageCore::ImageParallelForGetOneRowView ( const FImageView Image,
int64  Y 
)
inline

◆ ImageParallelForMakePart()

IMAGECORE_API int64 FImageCore::ImageParallelForMakePart ( FImageView Part,
const FImageView Whole,
int64  JobIndex,
int64  RowsPerJob 
)

◆ ImageParallelProcessLinearPixels()

template<typename Lambda >
void FImageCore::ImageParallelProcessLinearPixels ( const TCHAR DebugName,
const FImageView Image,
const Lambda &  Func 
)
inline

◆ ProcessLinearPixels()

template<typename Lambda >
void FImageCore::ProcessLinearPixels ( const FImageView Image,
const Lambda &  Func,
int64  StartY 
)
inline

ProcessLinearPixels act on image pixels as TArrayView64<FLinearColor> Colors pass a lambda that is : ProcessLinearPixelsAction ProcessPixels(TArrayView64<FLinearColor> Colors) return ProcessLinearPixelsAction::Modified if you modify colors return ProcessLinearPixelsAction::ReadOnly if you only read and don't change colors your lambda will be called on one row at a time

◆ ResizeImage()

IMAGECORE_API void FImageCore::ResizeImage ( const FImageView SourceImage,
const FImageView DestImage,
EResizeImageFilter  Filter = EResizeImageFilter::Default 
)

◆ ResizeImageAllocDest() [1/2]

IMAGECORE_API void FImageCore::ResizeImageAllocDest ( const FImageView SourceImage,
FImage DestImage,
int32  DestSizeX,
int32  DestSizeY,
ERawImageFormat::Type  DestFormat,
EGammaSpace  DestGammaSpace,
EResizeImageFilter  Filter = EResizeImageFilter::Default 
)

◆ ResizeImageAllocDest() [2/2]

IMAGECORE_API void FImageCore::ResizeImageAllocDest ( const FImageView SourceImage,
FImage DestImage,
int32  DestSizeX,
int32  DestSizeY,
EResizeImageFilter  Filter = EResizeImageFilter::Default 
)

◆ ResizeImageInPlace() [1/2]

IMAGECORE_API void FImageCore::ResizeImageInPlace ( FImage Image,
int32  DestSizeX,
int32  DestSizeY,
ERawImageFormat::Type  DestFormat,
EGammaSpace  DestGammaSpace,
EResizeImageFilter  Filter = EResizeImageFilter::Default 
)

◆ ResizeImageInPlace() [2/2]

IMAGECORE_API void FImageCore::ResizeImageInPlace ( FImage Image,
int32  DestSizeX,
int32  DestSizeY,
EResizeImageFilter  Filter = EResizeImageFilter::Default 
)

◆ ResizeTo()

void FImageCore::ResizeTo ( const FImageView SourceImage,
FImage DestImage,
int32  DestSizeX,
int32  DestSizeY,
ERawImageFormat::Type  DestFormat,
EGammaSpace  DestGammaSpace 
)

Copies and resizes the image to a destination image with the specified size and format. Resize is done using bilinear filtering; gamma correct (light linear) by converting through RGBA32F.

legacy API, prefer ResizeImage

Parameters
DestImage- The destination image.
DestSizeX- Width of the resized image
DestSizeY- Height of the resized image
DestFormat- The destination image format.
DestSRGB- Whether the destination image is in SRGB format.

◆ SanitizeFloat16AndSetAlphaOpaqueForBC6H()

void FImageCore::SanitizeFloat16AndSetAlphaOpaqueForBC6H ( const FImageView InOutImage)

Clamp Float16 colors which aren't encodable in the BC6H format RGB is clamped to non-negative and finite A is set to 1.0

Parameters
InOutImageis modified. Must be RGBA16F. (the FImageView is const but what it points at is not)

◆ ScaleChannelsSoMinMaxIsInZeroToOne()

bool FImageCore::ScaleChannelsSoMinMaxIsInZeroToOne ( const FImageView ImageToModify)

If the image has any values outside the [0,1] range, rescale that edge of the domain so that it is in [0,1] does not affect images that were previously in [0,1]

also does not change the side of the domain that is not out of bounds eg. values in [0.25,200.0] will be rescaled to [0.25,1.0]

returns bool if any change was made

If the input format is U8 or U16, no change will ever be made and this will return false.

This can be useful if you want to save an HDR/float image to a U8 image format for visualization. This is equivalent to what's called the "UNorm" transformation by the RenderTarget ReadPixels functions.

◆ SetAlphaOpaque()

void FImageCore::SetAlphaOpaque ( const FImageView InImage)

Change alpha channel to opaque, if present

Parameters
InImage- The image to look for alpha in.

◆ TransformToWorkingColorSpace()

void FImageCore::TransformToWorkingColorSpace ( const FImageView InLinearImage,
const FVector2d SourceRedChromaticity,
const FVector2d SourceGreenChromaticity,
const FVector2d SourceBlueChromaticity,
const FVector2d SourceWhiteChromaticity,
UE::Color::EChromaticAdaptationMethod  Method,
double  EqualityTolerance = 1.e-7 
)

Apply a color space transformation from the source chromaticities to the engine's working color space.

Parameters
InLinearImage- The image to convert, which must be linear.
SourceRedChromaticity- The red chromaticity coordinate of the source color space.
SourceGreenChromaticity- The green chromaticity coordinate of the source color space.
SourceBlueChromaticity- The blue chromaticity coordinate of the source color space.
SourceWhiteChromaticity- The white chromaticity coordinate of the source color space.
Method- The chromatic adapation method.
EqualityTolerance- The tolerance for the source and working color space chromaticities to be considered equal, bypassing the transform.

◆ TransposeImageRGBABGRA()

IMAGECORE_API void FImageCore::TransposeImageRGBABGRA ( const FImageView Image)

Swap RB channels on Image. Image must be BGRA8 or RGBA16.

Parameters
Imageis modified (the FImageView is const but what it points at is not)