Class CaptureImageEncoder
Provides methods for encoding raw texture data to common image formats such as PNG, JPG, EXR, TGA, and raw bytes.
Inherited Members
Namespace: Unity.SimulationPro
Assembly: Unity.SimulationPro.Capture.dll
Syntax
public static class CaptureImageEncoder
Methods
Decode(byte[], ref int, ref int, ImageFormat)
Decoding is no longer supported and always throws NotSupportedException.
Declaration
[Obsolete("Decoding is no longer supported.")]
public static byte[] Decode(byte[] data, ref int width, ref int height, CaptureImageEncoder.ImageFormat imageFormat)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | Encoded image data (unused). |
| int | width | Image width (unused). |
| int | height | Image height (unused). |
| CaptureImageEncoder.ImageFormat | imageFormat | Target format (unused). |
Returns
| Type | Description |
|---|---|
| byte[] | Never returns; always throws. |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Always thrown. |
Encode(Array, int, int, GraphicsFormat, ImageFormat, bool, int)
Encode the data with provided image format.
Declaration
[Obsolete("Encode supporting flipY has been deprecated. Use EncodeArray instead.")]
public static Array Encode(Array data, int width, int height, GraphicsFormat format, CaptureImageEncoder.ImageFormat imageFormat, bool flipY = true, int additionalParam = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | data | Array of data to be encoded |
| int | width | Texture/Image width |
| int | height | Texture/Image height |
| GraphicsFormat | format | Graphics Format used for the render texture |
| CaptureImageEncoder.ImageFormat | imageFormat | Format in which the data is to be encoded |
| bool | flipY | Boolean flag indicating if the image needs to be flipped |
| int | additionalParam | Additional flags to be provided for image conversion (optional) |
Returns
| Type | Description |
|---|---|
| Array | The encoded image data as an array, or the raw data unchanged for Raw. |
EncodeArray(Array, int, int, GraphicsFormat, ImageFormat, int)
Encode the input data as per provided image format.
Declaration
public static Array EncodeArray(Array data, int width, int height, GraphicsFormat format, CaptureImageEncoder.ImageFormat imageFormat, int additionalParam = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | data | An array of data to be encoded. |
| int | width | Image width. |
| int | height | Image height. |
| GraphicsFormat | format | Graphics format used by the render texture. |
| CaptureImageEncoder.ImageFormat | imageFormat | Format for encoding the data. |
| int | additionalParam | Additional flags to be passed for the encoding. |
Returns
| Type | Description |
|---|---|
| Array | The encoded image data as an array, or the raw data unchanged for Raw. |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Thrown when the specified |
EnforceFileExtension(string, ImageFormat)
Appends the provided file path with the imageFormat
Declaration
public static string EnforceFileExtension(string path, CaptureImageEncoder.ImageFormat imageFormat)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | Path to the file |
| CaptureImageEncoder.ImageFormat | imageFormat | Image format to be appended at the end of the file path |
Returns
| Type | Description |
|---|---|
| string | A string of filePath with extension. |