Description
The ImageFormat.I8
field is a member of the ImageFormat
enumeration in the Sandbox namespace. It represents an image format where each pixel is stored as a single 8-bit intensity value. This format is typically used for grayscale images where color information is not required, and only the intensity of light is represented.
Usage
Use ImageFormat.I8
when you need to work with grayscale images in your application. This format is efficient in terms of memory usage, as it only requires 8 bits per pixel. It is suitable for applications where color information is not necessary, such as certain types of image processing or analysis tasks.
Example
// Example of using ImageFormat.I8
Texture texture = new Texture("path/to/grayscale/image", ImageFormat.I8);
// Use the texture in a material or render it directly
Material material = new Material();
material.SetTexture("diffuse", texture);
// Render the material in a scene
Scene scene = new Scene();
GameObject obj = new GameObject();
obj.AddComponent<MeshRenderer>().Material = material;
scene.Add(obj);