reckfellENGINE

Image

Image datatype.

On this page
class ImageReckfellSharpInherits Resource

Image datatype.

Native image datatype. Contains image data which can be converted to an ImageTexture and provides commonly used image processing methods. The maximum width and height for an Image are Image.MaxWidth and Image.MaxHeight. An Image cannot be assigned to a texture property of an object directly (such as Sprite2D.Texture), and has to be converted manually to an ImageTexture first. Note: Methods that modify the image data cannot be used on VRAM-compressed images. Use Image.Decompress to convert the image to an uncompressed format first. Note: The maximum image size is 16384×16384 pixels due to graphics hardware limitations. Larger images may fail to import.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

ImageConstructor
# Image
C#
public Image();

Properties1

DataProperty
# Data
C#
public Reckfell.Collections.Dictionary Data { get; set; }

Holds all the image's color data in a given format. See Image.Format constants.

Methods92

AdjustBcsvoid
# AdjustBcs
C#
public void AdjustBcs(float brightness, float contrast, float saturation);

Adjusts this image's brightness, contrast, and saturation by the given values. Does not work if the image is compressed (see Image.IsCompressed).

Parameters
NameTypeDefault
brightnessfloat—
contrastfloat—
saturationfloat—
BlendRectvoid
# BlendRect
C#
public void BlendRect(Image src, Rect2I srcRect, Vector2I dst);

Alpha-blends src_rect from src image to this image at coordinates dst, clipped accordingly to both image bounds. This image and src image must have the same format. src_rect with non-positive size is treated as empty. Note: Simultaneously reading and writing to the same image reference may lead to unexpected results.

Parameters
NameTypeDefault
srcImage—
srcRectRect2I—
dstVector2I—
BlendRectMaskvoid
# BlendRectMask
C#
public void BlendRectMask(Image src, Image mask, Rect2I srcRect, Vector2I dst);

Alpha-blends src_rect from src image to this image using mask image at coordinates dst, clipped accordingly to both image bounds. Alpha channels are required for both src and mask. dst pixels and src pixels will blend if the corresponding mask pixel's alpha value is not 0. This image and src image must have the same format. src image and mask image must have the same size (width and height) but they can have different formats. src_rect with non-positive size is treated as empty.

Parameters
NameTypeDefault
srcImage—
maskImage—
srcRectRect2I—
dstVector2I—
BlitRectvoid
# BlitRect
C#
public void BlitRect(Image src, Rect2I srcRect, Vector2I dst);

Copies src_rect from src image to this image at coordinates dst, clipped accordingly to both image bounds. This image and src image must have the same format. src_rect with non-positive size is treated as empty. Note: The alpha channel data in src will overwrite the corresponding data in this image at the target position. To blend alpha channels, use Image.BlendRect instead.

Parameters
NameTypeDefault
srcImage—
srcRectRect2I—
dstVector2I—
BlitRectMaskvoid
# BlitRectMask
C#
public void BlitRectMask(Image src, Image mask, Rect2I srcRect, Vector2I dst);

Blits src_rect area from src image to this image at the coordinates given by dst, clipped accordingly to both image bounds. src pixel is copied onto dst if the corresponding mask pixel's alpha value is not 0. This image and src image must have the same format. src image and mask image must have the same size (width and height) but they can have different formats. src_rect with non-positive size is treated as empty.

Parameters
NameTypeDefault
srcImage—
maskImage—
srcRectRect2I—
dstVector2I—
BumpMapToNormalMapvoid
# BumpMapToNormalMap
C#
public void BumpMapToNormalMap(float bumpScale = 1f);

Converts a bump map to a normal map. A bump map provides a height offset per-pixel, while a normal map provides a normal direction per pixel.

Parameters
NameTypeDefault
bumpScalefloat1f
ClearMipmapsvoid
# ClearMipmaps
C#
public void ClearMipmaps();

Removes the image's mipmaps.

Compress2 overloads
# Compress · 1/2
C#
public Error Compress(Image.CompressMode mode, Image.CompressSource source, Image.AstcFormat astcFormat);

Compresses the image with a VRAM-compressed format to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. The source parameter helps to pick the best compression method for DXT and ETC2 formats. It is ignored for ASTC compression. The profile lets the user pick whether the compression should prioritize quality or a smaller size. Only ASTC compression uses this currently. Note: Image.Compress is only supported in editor builds. When run in an exported project, this method always returns ERR_UNAVAILABLE.

Parameters
NameTypeDefault
modeImage.CompressMode—
sourceImage.CompressSource—
astcFormatImage.AstcFormat—
Returns Error
# Compress · 2/2
C#
public Error Compress(Image.CompressMode mode, Image.CompressSource source = Image.CompressSource.Generic, Image.CompressProfile profile = Image.CompressProfile.Automatic);

Compresses the image with a VRAM-compressed format to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. The source parameter helps to pick the best compression method for DXT and ETC2 formats. It is ignored for ASTC compression. The profile lets the user pick whether the compression should prioritize quality or a smaller size. Only ASTC compression uses this currently. Note: Image.Compress is only supported in editor builds. When run in an exported project, this method always returns ERR_UNAVAILABLE.

Parameters
NameTypeDefault
modeImage.CompressMode—
sourceImage.CompressSourceImage.CompressSource.Generic
profileImage.CompressProfileImage.CompressProfile.Automatic
Returns Error
CompressFromChannels2 overloads
# CompressFromChannels · 1/2
C#
public Error CompressFromChannels(Image.CompressMode mode, Image.UsedChannels channels, Image.AstcFormat astcFormat);

Compresses the image with a VRAM-compressed format to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. This is an alternative to Image.Compress that lets the user supply the channels used in order for the compressor to pick the best DXT, ETC2, and ASTC formats. For other formats (non DXT, ETC2, or ASTC), this argument is ignored. The profile lets the user pick whether the compression should prioritize quality or a smaller size. Only ASTC compression uses this currently. Note: Image.CompressFromChannels is only supported in editor builds. When run in an exported project, this method always returns ERR_UNAVAILABLE.

Parameters
NameTypeDefault
modeImage.CompressMode—
channelsImage.UsedChannels—
astcFormatImage.AstcFormat—
Returns Error
# CompressFromChannels · 2/2
C#
public Error CompressFromChannels(Image.CompressMode mode, Image.UsedChannels channels, Image.CompressProfile profile = Image.CompressProfile.Automatic);

Compresses the image with a VRAM-compressed format to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. This is an alternative to Image.Compress that lets the user supply the channels used in order for the compressor to pick the best DXT, ETC2, and ASTC formats. For other formats (non DXT, ETC2, or ASTC), this argument is ignored. The profile lets the user pick whether the compression should prioritize quality or a smaller size. Only ASTC compression uses this currently. Note: Image.CompressFromChannels is only supported in editor builds. When run in an exported project, this method always returns ERR_UNAVAILABLE.

Parameters
NameTypeDefault
modeImage.CompressMode—
channelsImage.UsedChannels—
profileImage.CompressProfileImage.CompressProfile.Automatic
Returns Error
ComputeImageMetricsReckfell.Collections.Dictionary
# ComputeImageMetrics
C#
public Reckfell.Collections.Dictionary ComputeImageMetrics(Image comparedImage, bool useLuma);

Compute image metrics on the current image and the compared image. This can be used to calculate the similarity between two images. The dictionary contains max, mean, mean_squared, root_mean_squared and peak_snr.

Parameters
NameTypeDefault
comparedImageImage—
useLumabool—
Returns Reckfell.Collections.Dictionary
Convertvoid
# Convert
C#
public void Convert(Image.Format format);

Converts this image's format to the given format.

Parameters
NameTypeDefault
formatImage.Format—
CopyFromvoid
# CopyFrom
C#
public void CopyFrom(Image src);

Copies src image to this image.

Parameters
NameTypeDefault
srcImage—
CreateImage · Deprecated
# Create
C#
public static Image Create(int width, int height, bool useMipmaps, Image.Format format);

Creates an empty image of the given size and format. If use_mipmaps is true, generates mipmaps for this image (see Image.GenerateMipmaps).

Parameters
NameTypeDefault
widthint—
heightint—
useMipmapsbool—
formatImage.Format—
Returns Image
CreateEmptyImage
# CreateEmpty
C#
public static Image CreateEmpty(int width, int height, bool useMipmaps, Image.Format format);

Creates an empty image of the given size and format. If use_mipmaps is true, generates mipmaps for this image (see Image.GenerateMipmaps).

Parameters
NameTypeDefault
widthint—
heightint—
useMipmapsbool—
formatImage.Format—
Returns Image
CreateFromData2 overloads
# CreateFromData · 1/2
C#
public static Image CreateFromData(int width, int height, bool useMipmaps, Image.Format format, byte[] data);

Creates a new image of the given size and format. Fills the image with the given raw data. If use_mipmaps is true, loads the mipmaps for this image from Image.Data. See Image.GenerateMipmaps.

Parameters
NameTypeDefault
widthint—
heightint—
useMipmapsbool—
formatImage.Format—
databyte[]—
Returns Image
# CreateFromData · 2/2
C#
public static Image CreateFromData(int width, int height, bool useMipmaps, Image.Format format, ReadOnlySpan<byte> data);

Creates a new image of the given size and format. Fills the image with the given raw data. If use_mipmaps is true, loads the mipmaps for this image from Image.Data. See Image.GenerateMipmaps.

Parameters
NameTypeDefault
widthint—
heightint—
useMipmapsbool—
formatImage.Format—
dataReadOnlySpan<byte>—
Returns Image
Cropvoid
# Crop
C#
public void Crop(int width, int height);

Crops the image to the given width and height. If the specified size is larger than the current size, the extra area is filled with black pixels.

Parameters
NameTypeDefault
widthint—
heightint—
DecompressError
# Decompress
C#
public Error Decompress();

Decompresses the image if it is VRAM-compressed in a supported format. This increases memory utilization, but allows modifying the image. Returns OK if the format is supported, otherwise ERR_UNAVAILABLE. All VRAM-compressed formats supported by Reckfell can be decompressed with this method, except Image.Format.Etc2R11S, Image.Format.Etc2Rg11S, and Image.Format.Etc2Rgb8A1.

Returns Error
DetectAlphaImage.AlphaMode
# DetectAlpha
C#
public Image.AlphaMode DetectAlpha();

Returns Image.AlphaMode.Blend if the image has data for alpha values. Returns Image.AlphaMode.Bit if all the alpha values are stored in a single bit. Returns Image.AlphaMode.None if no data for alpha values is found.

Returns Image.AlphaMode
DetectUsedChannelsImage.UsedChannels
# DetectUsedChannels
C#
public Image.UsedChannels DetectUsedChannels(Image.CompressSource source = Image.CompressSource.Generic);

Returns the color channels used by this image. If the image is compressed, the original source must be specified.

Parameters
NameTypeDefault
sourceImage.CompressSourceImage.CompressSource.Generic
Returns Image.UsedChannels
Fillvoid
# Fill
C#
public void Fill(Color color);

Fills the image with color.

Parameters
NameTypeDefault
colorColor—
FillRectvoid
# FillRect
C#
public void FillRect(Rect2I rect, Color color);

Fills rect with color.

Parameters
NameTypeDefault
rectRect2I—
colorColor—
FixAlphaEdgesvoid
# FixAlphaEdges
C#
public void FixAlphaEdges();

Blends low-alpha pixels with nearby pixels.

FlipXvoid
# FlipX
C#
public void FlipX();

Flips the image horizontally.

FlipYvoid
# FlipY
C#
public void FlipY();

Flips the image vertically.

GenerateMipmaps2 overloads
# GenerateMipmaps · 1/2
C#
public Error GenerateMipmaps(bool renormalize);

Generates mipmaps for the image. Mipmaps are precalculated lower-resolution copies of the image that are automatically used if the image needs to be scaled down when rendered. They help improve image quality and performance when rendering. This method returns an error if the image is compressed, in a custom format, or if the image's width/height is 0. Enabling renormalize when generating mipmaps for normal map textures will make sure all resulting vector values are normalized. It is possible to check if the image has mipmaps by calling Image.HasMipmaps or Image.GetMipmapCount. Calling Image.GenerateMipmaps on an image that already has mipmaps will replace existing mipmaps in the image. If preserve_alpha_test_coverage is true it automatically adjusts alpha values to maintain consistent coverage when alpha testing is used. This is especially useful for hair, foliage, or other alpha-tested materials, as it prevents fading or popping artifacts across mipmap levels (LODs). This option is intended for color textures and clamps the alpha channel in the 0.0 - 1.0 range. The alpha_test_threshold parameter is the alpha threshold used when preserving alpha test coverage across mipmap levels. The coverage is measured at mipmap 0 using the setting and the lower mipmaps are adjusted to match that coverage. Higher values preserve more detail, lower values create softer edges. Note that this threshold is independent from the Alpha Scissor Threshold set on the material and they both may need to be tuned for optimal results.

Parameters
NameTypeDefault
renormalizebool—
Returns Error
# GenerateMipmaps · 2/2
C#
public Error GenerateMipmaps(bool renormalize = false, bool preserveAlphaTestCoverage = false, float alphaTestThreshold = 0.5f);

Generates mipmaps for the image. Mipmaps are precalculated lower-resolution copies of the image that are automatically used if the image needs to be scaled down when rendered. They help improve image quality and performance when rendering. This method returns an error if the image is compressed, in a custom format, or if the image's width/height is 0. Enabling renormalize when generating mipmaps for normal map textures will make sure all resulting vector values are normalized. It is possible to check if the image has mipmaps by calling Image.HasMipmaps or Image.GetMipmapCount. Calling Image.GenerateMipmaps on an image that already has mipmaps will replace existing mipmaps in the image. If preserve_alpha_test_coverage is true it automatically adjusts alpha values to maintain consistent coverage when alpha testing is used. This is especially useful for hair, foliage, or other alpha-tested materials, as it prevents fading or popping artifacts across mipmap levels (LODs). This option is intended for color textures and clamps the alpha channel in the 0.0 - 1.0 range. The alpha_test_threshold parameter is the alpha threshold used when preserving alpha test coverage across mipmap levels. The coverage is measured at mipmap 0 using the setting and the lower mipmaps are adjusted to match that coverage. Higher values preserve more detail, lower values create softer edges. Note that this threshold is independent from the Alpha Scissor Threshold set on the material and they both may need to be tuned for optimal results.

Parameters
NameTypeDefault
renormalizeboolfalse
preserveAlphaTestCoverageboolfalse
alphaTestThresholdfloat0.5f
Returns Error
GetDatabyte[]
# GetData
C#
public byte[] GetData();

Returns a copy of the image's raw data.

Returns byte[]
GetDataSizelong
# GetDataSize
C#
public long GetDataSize();

Returns size (in bytes) of the image's raw data.

Returns long
GetFormatImage.Format
# GetFormat
C#
public Image.Format GetFormat();

Returns this image's format.

Returns Image.Format
GetHeightint
# GetHeight
C#
public int GetHeight();

Returns the image's height.

Returns int
GetMipmapCountint
# GetMipmapCount
C#
public int GetMipmapCount();

Returns the number of lower-resolution levels, excluding the base image. The tested 32×16 image has five such levels in its complete chain.

Returns int

Number of mip levels after the base, or 0 when mipmaps are absent.

GetMipmapOffsetlong
# GetMipmapOffset
C#
public long GetMipmapOffset(int mipmap);

Returns the offset where the image's mipmap with index mipmap is stored in the Image.Data dictionary.

Parameters
NameTypeDefault
mipmapint—
Returns long
GetPixelColor
# GetPixel
C#
public Color GetPixel(int x, int y);

Reads a base-level Image pixel on the CPU. Supply coordinates within the image dimensions; obtain a readable representation first for a compressed format. This is not filtered shader sampling or source_color conversion.

Parameters
NameTypeDefault
xint—
yint—
x

Integer horizontal coordinate from 0 through width minus 1.

y

Integer vertical coordinate from 0 through height minus 1.

Returns Color

Pixel Color in the Image representation, not the final lit/exposed material color.

GetPixelvColor
# GetPixelv
C#
public Color GetPixelv(Vector2I point);

Returns the color of the pixel at point. This is the same as Image.GetPixel, but with a Vector2I argument instead of two integer arguments.

Parameters
NameTypeDefault
pointVector2I—
Returns Color
GetRegionImage
# GetRegion
C#
public Image GetRegion(Rect2I region);

Returns a new Image that is a copy of this Image's area specified with region.

Parameters
NameTypeDefault
regionRect2I—
Returns Image
GetSizeVector2I
# GetSize
C#
public Vector2I GetSize();

Returns the image's size (width and height).

Returns Vector2I
GetUsedRectRect2I
# GetUsedRect
C#
public Rect2I GetUsedRect();

Returns a Rect2I enclosing the visible portion of the image, considering each pixel with a non-zero alpha channel as visible.

Returns Rect2I
GetWidthint
# GetWidth
C#
public int GetWidth();

Returns the image's width.

Returns int
HasMipmapsbool
# HasMipmaps
C#
public bool HasMipmaps();

Reports whether the Image contains lower-resolution mip levels in addition to the base image. Does not select a material filter or enable shader sampling of those levels.

Returns bool

true when a mipmap chain is present, otherwise false.

IsCompressedbool
# IsCompressed
C#
public bool IsCompressed();

Returns true if the image is compressed.

Returns bool
IsEmptybool
# IsEmpty
C#
public bool IsEmpty();

Returns true if the image has no data.

Returns bool
IsInvisiblebool
# IsInvisible
C#
public bool IsInvisible();

Returns true if all the image's pixels have an alpha value of 0. Returns false if any pixel has an alpha value higher than 0.

Returns bool
LinearToSrgbvoid
# LinearToSrgb
C#
public void LinearToSrgb();

Converts the entire image from linear encoding to nonlinear sRGB encoding. Only works on images with Image.Format.Rgb8, Image.Format.Rgba8, Image.Format.Rgbh, or Image.Format.Rgbah format.

LoadError
# Load
C#
public Error Load(string path);

Loads an image from file path. See Supported image formats for a list of supported image formats and limitations. Warning: This method should only be used in the editor or in cases when you need to load external images at run-time, such as images located at the user:// directory, and may not work in exported projects. See also ImageTexture description for usage examples.

Parameters
NameTypeDefault
pathstring—
Returns Error
LoadBmpFromBuffer2 overloads
# LoadBmpFromBuffer · 1/2
C#
public Error LoadBmpFromBuffer(byte[] buffer);

Loads an image from the binary contents of a BMP file. Note: Reckfell's BMP module doesn't support 16-bit per pixel images. Only 1-bit, 4-bit, 8-bit, 24-bit, and 32-bit per pixel images are supported. Note: This method is only available in engine builds with the BMP module enabled. By default, the BMP module is enabled, but it can be disabled at build-time using the module_bmp_enabled=no SCons option.

Parameters
NameTypeDefault
bufferbyte[]—
Returns Error
# LoadBmpFromBuffer · 2/2
C#
public Error LoadBmpFromBuffer(ReadOnlySpan<byte> buffer);

Loads an image from the binary contents of a BMP file. Note: Reckfell's BMP module doesn't support 16-bit per pixel images. Only 1-bit, 4-bit, 8-bit, 24-bit, and 32-bit per pixel images are supported. Note: This method is only available in engine builds with the BMP module enabled. By default, the BMP module is enabled, but it can be disabled at build-time using the module_bmp_enabled=no SCons option.

Parameters
NameTypeDefault
bufferReadOnlySpan<byte>—
Returns Error
LoadDdsFromBuffer2 overloads
# LoadDdsFromBuffer · 1/2
C#
public Error LoadDdsFromBuffer(byte[] buffer);

Loads an image from the binary contents of a DDS file. Note: This method is only available in engine builds with the DDS module enabled. By default, the DDS module is enabled, but it can be disabled at build-time using the module_dds_enabled=no SCons option.

Parameters
NameTypeDefault
bufferbyte[]—
Returns Error
# LoadDdsFromBuffer · 2/2
C#
public Error LoadDdsFromBuffer(ReadOnlySpan<byte> buffer);

Loads an image from the binary contents of a DDS file. Note: This method is only available in engine builds with the DDS module enabled. By default, the DDS module is enabled, but it can be disabled at build-time using the module_dds_enabled=no SCons option.

Parameters
NameTypeDefault
bufferReadOnlySpan<byte>—
Returns Error
LoadExrFromBuffer2 overloads
# LoadExrFromBuffer · 1/2
C#
public Error LoadExrFromBuffer(byte[] buffer);

Loads an image from the binary contents of an OpenEXR file.

Parameters
NameTypeDefault
bufferbyte[]—
Returns Error
# LoadExrFromBuffer · 2/2
C#
public Error LoadExrFromBuffer(ReadOnlySpan<byte> buffer);

Loads an image from the binary contents of an OpenEXR file.

Parameters
NameTypeDefault
bufferReadOnlySpan<byte>—
Returns Error
LoadFromFileImage
# LoadFromFile
C#
public static Image LoadFromFile(string path);

Reads the source file directly, bypassing import settings. An imported project file produces an export warning in a debug build. Use ResourceLoader for a packaged Image resource; arrange raw-file availability separately in an exported game.

Parameters
NameTypeDefault
pathstring—
path

Accessible path to an actual file in a supported format. An imported texture may have different dimensions or processing; this method reads the original bytes.

Returns Image

Loaded Image, or null on a reading/decoding error. Check the result before processing.

LoadJpgFromBuffer2 overloads
# LoadJpgFromBuffer · 1/2
C#
public Error LoadJpgFromBuffer(byte[] buffer);

Loads an image from the binary contents of a JPEG file.

Parameters
NameTypeDefault
bufferbyte[]—
Returns Error
# LoadJpgFromBuffer · 2/2
C#
public Error LoadJpgFromBuffer(ReadOnlySpan<byte> buffer);

Loads an image from the binary contents of a JPEG file.

Parameters
NameTypeDefault
bufferReadOnlySpan<byte>—
Returns Error
LoadKtxFromBuffer2 overloads
# LoadKtxFromBuffer · 1/2
C#
public Error LoadKtxFromBuffer(byte[] buffer);

Loads an image from the binary contents of a KTX(https://github.com/KhronosGroup/KTX-Software) file. Unlike most image formats, KTX can store VRAM-compressed data and embed mipmaps. Note: Reckfell's libktx implementation only supports 2D images. Cubemaps, texture arrays, and de-padding are not supported. Note: This method is only available in engine builds with the KTX module enabled. By default, the KTX module is enabled, but it can be disabled at build-time using the module_ktx_enabled=no SCons option.

Parameters
NameTypeDefault
bufferbyte[]—
Returns Error
# LoadKtxFromBuffer · 2/2
C#
public Error LoadKtxFromBuffer(ReadOnlySpan<byte> buffer);

Loads an image from the binary contents of a KTX(https://github.com/KhronosGroup/KTX-Software) file. Unlike most image formats, KTX can store VRAM-compressed data and embed mipmaps. Note: Reckfell's libktx implementation only supports 2D images. Cubemaps, texture arrays, and de-padding are not supported. Note: This method is only available in engine builds with the KTX module enabled. By default, the KTX module is enabled, but it can be disabled at build-time using the module_ktx_enabled=no SCons option.

Parameters
NameTypeDefault
bufferReadOnlySpan<byte>—
Returns Error
LoadPngFromBuffer2 overloads
# LoadPngFromBuffer · 1/2
C#
public Error LoadPngFromBuffer(byte[] buffer);

Loads an image from the binary contents of a PNG file.

Parameters
NameTypeDefault
bufferbyte[]—
Returns Error
# LoadPngFromBuffer · 2/2
C#
public Error LoadPngFromBuffer(ReadOnlySpan<byte> buffer);

Loads an image from the binary contents of a PNG file.

Parameters
NameTypeDefault
bufferReadOnlySpan<byte>—
Returns Error
LoadSvgFromBuffer2 overloads
# LoadSvgFromBuffer · 1/2
C#
public Error LoadSvgFromBuffer(byte[] buffer, float scale = 1f);

Loads an image from the UTF-8 binary contents of an uncompressed SVG file (.svg). Note: Beware when using compressed SVG files (like .svgz), they need to be decompressed before loading. Note: This method is only available in engine builds with the SVG module enabled. By default, the SVG module is enabled, but it can be disabled at build-time using the module_svg_enabled=no SCons option.

Parameters
NameTypeDefault
bufferbyte[]—
scalefloat1f
Returns Error
# LoadSvgFromBuffer · 2/2
C#
public Error LoadSvgFromBuffer(ReadOnlySpan<byte> buffer, float scale);

Loads an image from the UTF-8 binary contents of an uncompressed SVG file (.svg). Note: Beware when using compressed SVG files (like .svgz), they need to be decompressed before loading. Note: This method is only available in engine builds with the SVG module enabled. By default, the SVG module is enabled, but it can be disabled at build-time using the module_svg_enabled=no SCons option.

Parameters
NameTypeDefault
bufferReadOnlySpan<byte>—
scalefloat—
Returns Error
LoadSvgFromStringError
# LoadSvgFromString
C#
public Error LoadSvgFromString(string svgStr, float scale = 1f);

Loads an image from the string contents of an SVG file (.svg). Note: This method is only available in engine builds with the SVG module enabled. By default, the SVG module is enabled, but it can be disabled at build-time using the module_svg_enabled=no SCons option.

Parameters
NameTypeDefault
svgStrstring—
scalefloat1f
Returns Error
LoadTgaFromBuffer2 overloads
# LoadTgaFromBuffer · 1/2
C#
public Error LoadTgaFromBuffer(byte[] buffer);

Loads an image from the binary contents of a TGA file. Note: This method is only available in engine builds with the TGA module enabled. By default, the TGA module is enabled, but it can be disabled at build-time using the module_tga_enabled=no SCons option.

Parameters
NameTypeDefault
bufferbyte[]—
Returns Error
# LoadTgaFromBuffer · 2/2
C#
public Error LoadTgaFromBuffer(ReadOnlySpan<byte> buffer);

Loads an image from the binary contents of a TGA file. Note: This method is only available in engine builds with the TGA module enabled. By default, the TGA module is enabled, but it can be disabled at build-time using the module_tga_enabled=no SCons option.

Parameters
NameTypeDefault
bufferReadOnlySpan<byte>—
Returns Error
LoadWebpFromBuffer2 overloads
# LoadWebpFromBuffer · 1/2
C#
public Error LoadWebpFromBuffer(byte[] buffer);

Loads an image from the binary contents of a WebP file.

Parameters
NameTypeDefault
bufferbyte[]—
Returns Error
# LoadWebpFromBuffer · 2/2
C#
public Error LoadWebpFromBuffer(ReadOnlySpan<byte> buffer);

Loads an image from the binary contents of a WebP file.

Parameters
NameTypeDefault
bufferReadOnlySpan<byte>—
Returns Error
NormalMapToXyvoid
# NormalMapToXy
C#
public void NormalMapToXy();

Converts the image's data to represent coordinates on a 3D plane. This is used when the image represents a normal map. A normal map can add lots of detail to a 3D surface without increasing the polygon count.

PremultiplyAlphavoid
# PremultiplyAlpha
C#
public void PremultiplyAlpha();

Multiplies color values with alpha values. Resulting color values for a pixel are (color * alpha)/256. See also CanvasItemMaterial.BlendMode.

Resizevoid
# Resize
C#
public void Resize(int width, int height, Image.Interpolation interpolation = Image.Interpolation.Bilinear);

Resizes the image to the given width and height. New pixels are calculated using the interpolation mode defined via Image.Interpolation constants. Note: If the image's format is Image.Format.Rgba4444, Image.Format.Rgb565, or Image.Format.Rgbe9995, it will be temporarily converted to either Image.Format.Rgba8 or Image.Format.Rgbah. This can affect the quality of the resized image.

Parameters
NameTypeDefault
widthint—
heightint—
interpolationImage.InterpolationImage.Interpolation.Bilinear
ResizeToPo2void
# ResizeToPo2
C#
public void ResizeToPo2(bool square = false, Image.Interpolation interpolation = Image.Interpolation.Bilinear);

Resizes the image to the nearest power of 2 for the width and height. If square is true, sets width and height to be the same. New pixels are calculated using the interpolation mode defined via Image.Interpolation constants.

Parameters
NameTypeDefault
squareboolfalse
interpolationImage.InterpolationImage.Interpolation.Bilinear
RgbeToSrgbImage
# RgbeToSrgb
C#
public Image RgbeToSrgb();

Converts a standard linear RGBE (Red Green Blue Exponent) image to an image that uses nonlinear sRGB encoding.

Returns Image
Rotate180void
# Rotate180
C#
public void Rotate180();

Rotates the image by 180 degrees. The width and height of the image must be greater than 1.

Rotate90void
# Rotate90
C#
public void Rotate90(ClockDirection direction);

Rotates the image in the specified direction by 90 degrees. The width and height of the image must be greater than 1. If the width and height are not equal, the image will be resized.

Parameters
NameTypeDefault
directionClockDirection—
SaveDdsError
# SaveDds
C#
public Error SaveDds(string path);

Saves the image as a DDS (DirectDraw Surface) file to path. DDS is a container format that can store textures in various compression formats, such as DXT1, DXT5, or BC7. This function will return ERR_UNAVAILABLE if Reckfell was compiled without the DDS module. Note: The DDS module may be disabled in certain builds, which means Image.SaveDds will return ERR_UNAVAILABLE when it is called from an exported project.

Parameters
NameTypeDefault
pathstring—
Returns Error
SaveDdsToBufferbyte[]
# SaveDdsToBuffer
C#
public byte[] SaveDdsToBuffer();

Saves the image as a DDS (DirectDraw Surface) file to a byte array. DDS is a container format that can store textures in various compression formats, such as DXT1, DXT5, or BC7. This function will return an empty byte array if Reckfell was compiled without the DDS module. Note: The DDS module may be disabled in certain builds, which means Image.SaveDdsToBuffer will return an empty byte array when it is called from an exported project.

Returns byte[]
SaveExr2 overloads
# SaveExr · 1/2
C#
public Error SaveExr(string path, bool grayscale);

Writes the Image to EXR, preserving negative float values without an upper clamp. Supports uncompressed R/RG/RGB/RGBA 8-bit, half-float and float data. Does not apply an sRGB transfer or tone mapping; cannot recover values lost before saving.

Parameters
NameTypeDefault
pathstring—
grayscalebool—
path

Output file path in a writable directory, for example user://image.exr.

grayscale

For a single-channel image, true labels the channel as luminance Y instead of R. Does not convert RGB to grayscale.

Returns Error

Error.Ok on successful writing; otherwise an error code. Without the corresponding writer, Error.Unavailable. Check the result before using the file.

# SaveExr · 2/2
C#
public Error SaveExr(string path, bool grayscale = false, bool colorImage = false, float maxLinearValue = -1f);

Writes the Image to EXR. colorImage clamps negative values; maxLinearValue upper-clamps channels. Supports uncompressed R/RG/RGB/RGBA 8-bit, half-float and float data. Does not apply an sRGB transfer or tone mapping; cannot recover values lost before saving.

Parameters
NameTypeDefault
pathstring—
grayscaleboolfalse
colorImageboolfalse
maxLinearValuefloat-1f
path

Output file path in a writable directory, for example user://image.exr.

grayscale

For a single-channel image, true labels the channel as luminance Y instead of R. Does not convert RGB to grayscale.

colorImage

If true, negative float/half-float channel values are clamped to zero. This is a data clamp, not a color-space conversion.

maxLinearValue

A nonnegative value upper-clamps each written channel. A negative value, including the default -1, disables the upper clamp. This is not exposure.

Returns Error

Error.Ok on successful writing; otherwise an error code. Without the corresponding writer, Error.Unavailable. Check the result before using the file.

SaveExrToBuffer2 overloads
# SaveExrToBuffer · 1/2
C#
public byte[] SaveExrToBuffer(bool grayscale);

Saves the image as an EXR file to a byte array. If grayscale is true and the image has only one channel, it will be saved explicitly as monochrome rather than one red channel. Set color_image to true when saving a color image, such as a screenshot. Negative values will be included when color_image is false, which may be useful for saving raw floating point data such as a lightmap that includes negative light information. Color component values in the resulting EXR file will not exceed max_linear_value if max_linear_value is not negative. This function will return an empty byte array if Reckfell was compiled without the TinyEXR module. When saving screenshots of a project that uses HDR output, use Window.GetOutputMaxLinearValue for max_linear_value.

Parameters
NameTypeDefault
grayscalebool—
Returns byte[]
# SaveExrToBuffer · 2/2
C#
public byte[] SaveExrToBuffer(bool grayscale = false, bool colorImage = false, float maxLinearValue = -1f);

Saves the image as an EXR file to a byte array. If grayscale is true and the image has only one channel, it will be saved explicitly as monochrome rather than one red channel. Set color_image to true when saving a color image, such as a screenshot. Negative values will be included when color_image is false, which may be useful for saving raw floating point data such as a lightmap that includes negative light information. Color component values in the resulting EXR file will not exceed max_linear_value if max_linear_value is not negative. This function will return an empty byte array if Reckfell was compiled without the TinyEXR module. When saving screenshots of a project that uses HDR output, use Window.GetOutputMaxLinearValue for max_linear_value.

Parameters
NameTypeDefault
grayscaleboolfalse
colorImageboolfalse
maxLinearValuefloat-1f
Returns byte[]
SaveJpgError
# SaveJpg
C#
public Error SaveJpg(string path, float quality = 0.75f);

Saves the image as a JPEG file to path with the specified quality between 0.01 and 1.0 (inclusive). Higher quality values result in better-looking output at the cost of larger file sizes. Recommended quality values are between 0.75 and 0.90. Even at quality 1.00, JPEG compression remains lossy. Note: JPEG does not save an alpha channel. If the Image contains an alpha channel, the image will still be saved, but the resulting JPEG file won't contain the alpha channel.

Parameters
NameTypeDefault
pathstring—
qualityfloat0.75f
Returns Error
SaveJpgToBufferbyte[]
# SaveJpgToBuffer
C#
public byte[] SaveJpgToBuffer(float quality = 0.75f);

Saves the image as a JPEG file to a byte array with the specified quality between 0.01 and 1.0 (inclusive). Higher quality values result in better-looking output at the cost of larger byte array sizes (and therefore memory usage). Recommended quality values are between 0.75 and 0.90. Even at quality 1.00, JPEG compression remains lossy. Note: JPEG does not save an alpha channel. If the Image contains an alpha channel, the image will still be saved, but the resulting byte array won't contain the alpha channel.

Parameters
NameTypeDefault
qualityfloat0.75f
Returns byte[]
SavePngError
# SavePng
C#
public Error SavePng(string path);

Writes the Image to PNG. A float source is converted to an 8-bit representation, clipping values above 1. Does not tone-map the image or automatically convert linear color to sRGB. For HDR data, use a suitable float source and SaveExr.

Parameters
NameTypeDefault
pathstring—
path

Output file path in a writable directory, for example user://image.png.

Returns Error

Error.Ok on successful writing; otherwise an error code. Without the corresponding writer, Error.Unavailable. Check the result before using the file.

SavePngToBufferbyte[]
# SavePngToBuffer
C#
public byte[] SavePngToBuffer();

Saves the image as a PNG file to a byte array.

Returns byte[]
SaveWebpError
# SaveWebp
C#
public Error SaveWebp(string path, bool lossy = false, float quality = 0.75f);

Saves the image as a WebP (Web Picture) file to the file at path. By default it will save lossless. If lossy is true, the image will be saved lossy, using the quality setting between 0.0 and 1.0 (inclusive). Lossless WebP offers more efficient compression than PNG. Note: The WebP format is limited to a size of 16383×16383 pixels, while PNG can save larger images.

Parameters
NameTypeDefault
pathstring—
lossyboolfalse
qualityfloat0.75f
Returns Error
SaveWebpToBufferbyte[]
# SaveWebpToBuffer
C#
public byte[] SaveWebpToBuffer(bool lossy = false, float quality = 0.75f);

Saves the image as a WebP (Web Picture) file to a byte array. By default it will save lossless. If lossy is true, the image will be saved lossy, using the quality setting between 0.0 and 1.0 (inclusive). Lossless WebP offers more efficient compression than PNG. Note: The WebP format is limited to a size of 16383×16383 pixels, while PNG can save larger images.

Parameters
NameTypeDefault
lossyboolfalse
qualityfloat0.75f
Returns byte[]
SetData2 overloads
# SetData · 1/2
C#
public void SetData(int width, int height, bool useMipmaps, Image.Format format, byte[] data);

Overwrites data of an existing Image. Non-static equivalent of Image.CreateFromData.

Parameters
NameTypeDefault
widthint—
heightint—
useMipmapsbool—
formatImage.Format—
databyte[]—
# SetData · 2/2
C#
public void SetData(int width, int height, bool useMipmaps, Image.Format format, ReadOnlySpan<byte> data);

Overwrites data of an existing Image. Non-static equivalent of Image.CreateFromData.

Parameters
NameTypeDefault
widthint—
heightint—
useMipmapsbool—
formatImage.Format—
dataReadOnlySpan<byte>—
SetPixelvoid
# SetPixel
C#
public void SetPixel(int x, int y, Color color);

Sets the Color of the pixel at (x, y) to color.

C#
int imgWidth = 10;
int imgHeight = 5;
var img = Image.Create(imgWidth, imgHeight, false, Image.Format.Rgba8);

img.SetPixel(1, 2, Colors.Red); // Sets the color at (1, 2) to red.

This is the same as Image.SetPixelv, but with a two integer arguments instead of a Vector2I argument. Note: Depending on the image's format, the color set here may be clamped or lose precision. Do not assume the color returned by Image.GetPixel to be identical to the one set here; any comparisons will likely need to use an approximation like Color.IsEqualApprox. Note: On grayscale image formats, only the red channel of color is used (and alpha if relevant). The green and blue channels are ignored.

Parameters
NameTypeDefault
xint—
yint—
colorColor—
SetPixelvvoid
# SetPixelv
C#
public void SetPixelv(Vector2I point, Color color);

Sets the Color of the pixel at point to color.

C#
int imgWidth = 10;
int imgHeight = 5;
var img = Image.Create(imgWidth, imgHeight, false, Image.Format.Rgba8);

img.SetPixelv(new Vector2I(1, 2), Colors.Red); // Sets the color at (1, 2) to red.

This is the same as Image.SetPixel, but with a Vector2I argument instead of two integer arguments. Note: Depending on the image's format, the color set here may be clamped or lose precision. Do not assume the color returned by Image.GetPixelv to be identical to the one set here; any comparisons will likely need to use an approximation like Color.IsEqualApprox. Note: On grayscale image formats, only the red channel of color is used (and alpha if relevant). The green and blue channels are ignored.

Parameters
NameTypeDefault
pointVector2I—
colorColor—
ShrinkX2void
# ShrinkX2
C#
public void ShrinkX2();

Shrinks the image by a factor of 2 on each axis (this divides the pixel count by 4).

SrgbToLinearvoid
# SrgbToLinear
C#
public void SrgbToLinear();

Converts the raw data from nonlinear sRGB encoding to linear encoding. Only works on images with Image.Format.Rgb8, Image.Format.Rgba8, Image.Format.Rgbh, or Image.Format.Rgbah format. Note: The 8-bit formats are not suitable for storing linearly encoded values; a significant amount of color information will be lost in darker values. Use this function on images that use a floating point format instead.

Fields and constants2

MaxHeightField
# MaxHeight
C#
public const long MaxHeight = 16777216;

The maximal height allowed for Image resources.

MaxWidthField
# MaxWidth
C#
public const long MaxWidth = 16777216;

The maximal width allowed for Image resources.

Image.AlphaMode

ValueDescription
Bit = 1

Image stores either fully opaque or fully transparent pixels. Also known as punchthrough alpha.

Blend = 2

Image stores alpha data with values varying between 0.0 and 1.0.

None = 0

Image is fully opaque. It does not store alpha data.

Image.AstcFormat

ValueDescription
Format4X4 = 0

Hint to indicate that the high quality 4×4 ASTC compression format should be used.

Format8X8 = 1

Hint to indicate that the low quality 8×8 ASTC compression format should be used.

Image.CompressMode

ValueDescription
Astc = 4

Use ASTC compression.

Bptc = 3

Use BPTC compression.

Etc = 1

Use ETC compression.

Etc2 = 2

Use ETC2 compression.

Max = 5

Represents the size of the Image.CompressMode enum.

S3Tc = 0

Use S3TC compression.

Image.CompressProfile

ValueDescription
Automatic = 0

Automatically adjusts the quality level based on the number of unique color channels present in the image. For ASTC, this corresponds to picking 8×8 when only one channel is detected (R, L), 6×6 when two channels are detected (RG, LA), and 4×4 in all other cases.

Compressed = 2

Prioritizes some compression over quality. For ASTC, this corresponds to using a 6×6 block size.

Max = 4

Represents the size of the Image.CompressProfile enum.

MaxCompression = 3

Prioritizes highest compression over quality. For ASTC, this corresponds to using an 8×8 block size.

MaxQuality = 1

Prioritizes highest quality over compression. For ASTC, this corresponds to using a 4×4 block size.

Image.CompressSource

ValueDescription
Generic = 0

Source texture (before compression) is a regular texture. Default for all textures.

Normal = 2

Source texture (before compression) is a normal texture (e.g. it can be compressed into two channels).

Srgb = 1

Source texture (before compression) uses nonlinear sRGB encoding.

Image.Format

ValueDescription
Astc4X4 = 35

Adaptive Scalable Texture Compression. This implements the 4×4 (high quality) mode.

Astc4X4Hdr = 36

Same format as Image.Format.Astc4X4, but with the hint to let the GPU know it is used for HDR.

Astc6X6 = 47

Adaptive Scalable Texture Compression. This implements the 6×6 (medium quality) mode.

Astc6X6Hdr = 48

Same format as Image.Format.Astc6X6, but with the hint to let the GPU know it is used for HDR.

Astc8X8 = 37

Adaptive Scalable Texture Compression. This implements the 8×8 (low quality) mode.

Astc8X8Hdr = 38

Same format as Image.Format.Astc8X8, but with the hint to let the GPU know it is used for HDR.

BptcRgba = 22

Texture format that uses BPTC(https://www.khronos.org/opengl/wiki/BPTC_Texture_Compression) compression with unsigned normalized RGBA components. Note: When creating an ImageTexture, a nonlinear sRGB to linear encoding conversion is performed.

BptcRgbf = 23

Texture format that uses BPTC(https://www.khronos.org/opengl/wiki/BPTC_Texture_Compression) compression with signed floating-point RGB components.

BptcRgbfu = 24

Texture format that uses BPTC(https://www.khronos.org/opengl/wiki/BPTC_Texture_Compression) compression with unsigned floating-point RGB components.

Dxt1 = 17

The S3TC(https://en.wikipedia.org/wiki/S3_Texture_Compression) texture format that uses Block Compression 1, and is the smallest variation of S3TC, only providing 1 bit of alpha and color data being premultiplied with alpha. Note: When creating an ImageTexture, a nonlinear sRGB to linear encoding conversion is performed.

Dxt3 = 18

The S3TC(https://en.wikipedia.org/wiki/S3_Texture_Compression) texture format that uses Block Compression 2, and color data is interpreted as not having been premultiplied by alpha. Well suited for images with sharp alpha transitions between translucent and opaque areas. Note: When creating an ImageTexture, a nonlinear sRGB to linear encoding conversion is performed.

Dxt5 = 19

The S3TC(https://en.wikipedia.org/wiki/S3_Texture_Compression) texture format also known as Block Compression 3 or BC3 that contains 64 bits of alpha channel data followed by 64 bits of DXT1-encoded color data. Color data is not premultiplied by alpha, same as DXT3. DXT5 generally produces superior results for transparent gradients compared to DXT3. Note: When creating an ImageTexture, a nonlinear sRGB to linear encoding conversion is performed.

Dxt5RaAsRg = 34

The S3TC(https://en.wikipedia.org/wiki/S3_Texture_Compression) texture format also known as Block Compression 3 or BC3, which compresses RA data and interprets it as two channels (red and green). See also Image.Format.Dxt5.

Etc = 25

Ericsson Texture Compression format 1, also referred to as "ETC1", and is part of the OpenGL ES graphics standard. This format cannot store an alpha channel.

Etc2R11 = 26

Ericsson Texture Compression format 2 (R11_EAC variant), which provides one channel of unsigned data.

Etc2R11S = 27

Ericsson Texture Compression format 2 (SIGNED_R11_EAC variant), which provides one channel of signed data.

Etc2RaAsRg = 33

Ericsson Texture Compression format 2 (RGBA8 variant), which compresses RA data and interprets it as two channels (red and green). See also Image.Format.Etc2Rgba8.

Etc2Rg11 = 28

Ericsson Texture Compression format 2 (RG11_EAC variant), which provides two channels of unsigned data.

Etc2Rg11S = 29

Ericsson Texture Compression format 2 (SIGNED_RG11_EAC variant), which provides two channels of signed data.

Etc2Rgb8 = 30

Ericsson Texture Compression format 2 (RGB8 variant), which is a follow-up of ETC1 and compresses RGB888 data. Note: When creating an ImageTexture, a nonlinear sRGB to linear encoding conversion is performed.

Etc2Rgb8A1 = 32

Ericsson Texture Compression format 2 (RGB8_PUNCHTHROUGH_ALPHA1 variant), which compresses RGBA data to make alpha either fully transparent or fully opaque. Note: When creating an ImageTexture, a nonlinear sRGB to linear encoding conversion is performed.

Etc2Rgba8 = 31

Ericsson Texture Compression format 2 (RGBA8variant), which compresses RGBA8888 data with full alpha support. Note: When creating an ImageTexture, a nonlinear sRGB to linear encoding conversion is performed.

L8 = 0

Texture format with a single 8-bit depth representing luminance.

La8 = 1

OpenGL texture format with two values, luminance and alpha each stored with 8 bits.

Max = 49

Represents the size of the Image.Format enum.

R16 = 39

OpenGL texture format GL_R16 where there's one component, a 16-bit unsigned normalized integer value. Since the value is normalized, each component is clamped between 0.0 and 1.0 (inclusive). Note: Due to limited hardware support, it is mainly recommended to be used on desktop or console devices. It may be unsupported on mobile or web, and will consequently be converted to Image.Format.Rf.

R16I = 43

OpenGL texture format GL_R16UI where there's one component, a 16-bit unsigned integer value. Each component is clamped between 0 and 65535 (inclusive). Note: When used in a shader, the texture requires usage of usampler samplers. Additionally, it only supports nearest-neighbor filtering under the Compatibility renderer. Note: When sampling using Image.GetPixel, returned Colors have to be divided by 65535 to get the correct color value.

R8 = 2

OpenGL texture format RED with a single component and a bitdepth of 8.

Rf = 8

OpenGL texture format GL_R32F where there's one component, a 32-bit floating-point value.

Rg16 = 40

OpenGL texture format GL_RG16 where there are two components, each a 16-bit unsigned normalized integer value. Since the value is normalized, each component is clamped between 0.0 and 1.0 (inclusive). Note: Due to limited hardware support, it is mainly recommended to be used on desktop or console devices. It may be unsupported on mobile or web, and will consequently be converted to Image.Format.Rgf.

Rg16I = 44

OpenGL texture format GL_RG16UI where there are two components, each a 16-bit unsigned integer value. Each component is clamped between 0 and 65535 (inclusive). Note: When used in a shader, the texture requires usage of usampler samplers. Additionally, it only supports nearest-neighbor filtering under the Compatibility renderer. Note: When sampling using Image.GetPixel, returned Colors have to be divided by 65535 to get the correct color value.

Rg8 = 3

OpenGL texture format RG with two components and a bitdepth of 8 for each.

Rgb16 = 41

OpenGL texture format GL_RGB16 where there are three components, each a 16-bit unsigned normalized integer value. Since the value is normalized, each component is clamped between 0.0 and 1.0 (inclusive). Note: Due to limited hardware support, it is mainly recommended to be used on desktop or console devices. It may be unsupported on mobile or web, and will consequently be converted to Image.Format.Rgbf.

Rgb16I = 45

OpenGL texture format GL_RGB16UI where there are three components, each a 16-bit unsigned integer value. Each component is clamped between 0 and 65535 (inclusive). Note: When used in a shader, the texture requires usage of usampler samplers. Additionally, it only supports nearest-neighbor filtering under the Compatibility renderer. Note: When sampling using Image.GetPixel, returned Colors have to be divided by 65535 to get the correct color value.

Rgb565 = 7

OpenGL texture format RGB with three components. Red and blue have a bitdepth of 5, and green has a bitdepth of 6.

Rgb8 = 4

OpenGL texture format RGB with three components, each with a bitdepth of 8. Note: When creating an ImageTexture, a nonlinear sRGB to linear encoding conversion is performed.

Rgba16 = 42

OpenGL texture format GL_RGBA16 where there are four components, each a 16-bit unsigned normalized integer value. Since the value is normalized, each component is clamped between 0.0 and 1.0 (inclusive). Note: Due to limited hardware support, it is mainly recommended to be used on desktop or console devices. It may be unsupported on mobile or web, and will consequently be converted to Image.Format.Rgbaf.

Rgba16I = 46

OpenGL texture format GL_RGBA16UI where there are four components, each a 16-bit unsigned integer value. Each component is clamped between 0 and 65535 (inclusive). Note: When used in a shader, the texture requires usage of usampler samplers. Additionally, it only supports nearest-neighbor filtering under the Compatibility renderer. Note: When sampling using Image.GetPixel, returned Colors have to be divided by 65535 to get the correct color value.

Rgba4444 = 6

OpenGL texture format RGBA with four components, each with a bitdepth of 4.

Rgba8 = 5

OpenGL texture format RGBA with four components, each with a bitdepth of 8. Note: When creating an ImageTexture, a nonlinear sRGB to linear encoding conversion is performed.

Rgbaf = 11

OpenGL texture format GL_RGBA32F where there are four components, each a 32-bit floating-point values.

Rgbah = 15

OpenGL texture format GL_RGBA16F where there are four components, each a 16-bit "half-precision" floating-point value.

Rgbe9995 = 16

A special OpenGL texture format where the three color components have 9 bits of precision and all three share a single 5-bit exponent.

Rgbf = 10

OpenGL texture format GL_RGB32F where there are three components, each a 32-bit floating-point values.

Rgbh = 14

OpenGL texture format GL_RGB16F where there are three components, each a 16-bit "half-precision" floating-point value.

Rgf = 9

OpenGL texture format GL_RG32F where there are two components, each a 32-bit floating-point values.

Rgh = 13

OpenGL texture format GL_RG16F where there are two components, each a 16-bit "half-precision" floating-point value.

RgtcR = 20

Texture format that uses Red Green Texture Compression, normalizing the red channel data using the same compression algorithm that DXT5 uses for the alpha channel.

RgtcRg = 21

Texture format that uses Red Green Texture Compression, normalizing the red and green channel data using the same compression algorithm that DXT5 uses for the alpha channel.

Rh = 12

OpenGL texture format GL_R16F where there's one component, a 16-bit "half-precision" floating-point value.

Image.Interpolation

ValueDescription
Bilinear = 1

Performs bilinear interpolation. If the image is resized, it will be blurry. This mode is faster than Image.Interpolation.Cubic, but it results in lower quality.

Cubic = 2

Performs cubic interpolation. If the image is resized, it will be blurry. This mode often gives better results compared to Image.Interpolation.Bilinear, at the cost of being slower.

Lanczos = 4

Performs Lanczos interpolation. This is the slowest image resizing mode, but it typically gives the best results, especially when downscaling images.

Nearest = 0

Performs nearest-neighbor interpolation. If the image is resized, it will be pixelated.

Trilinear = 3

Performs bilinear separately on the two most-suited mipmap levels, then linearly interpolates between them. It's slower than Image.Interpolation.Bilinear, but produces higher-quality results with far fewer aliasing artifacts. If the image does not have mipmaps, they will be generated and used internally, but no mipmaps will be generated on the resulting image. Note: If you intend to scale multiple copies of the original image, it's better to call Image.GenerateMipmaps on it in advance, to avoid wasting processing power in generating them again and again. On the other hand, if the image already has mipmaps, they will be used, and a new set will be generated for the resulting image.

Image.UsedChannels

ValueDescription
L = 0

The image only uses one channel for luminance (grayscale).

La = 1

The image uses two channels for luminance and alpha, respectively.

R = 2

The image only uses the red channel.

Rg = 3

The image uses two channels for red and green.

Rgb = 4

The image uses three channels for red, green, and blue.

Rgba = 5

The image uses four channels for red, green, blue, and alpha.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.