Table of Contents

Class ImageUtils

Namespace
Nautilus.Utility
Assembly
Nautilus.dll
A collection of image loading utility methods that can create Unity objects from image files at runtime.
public static class ImageUtils
Inheritance
ImageUtils
Inherited Members

Methods

LoadSpriteFromFile(string, TextureFormat)

Creates a new Atlas.Sprite from an image file.
public static Atlas.Sprite LoadSpriteFromFile(string filePathToImage, TextureFormat format = TextureFormat.BC7)

Parameters

filePathToImage string
The path to the image file.
format TextureFormat
The texture format. By default, this uses UnityEngine.TextureFormat.BC7.
https://docs.unity3d.com/ScriptReference/TextureFormat.BC7.html
Don't change this unless you really know what you're doing.

Returns

Atlas.Sprite
Will return a new Atlas.Sprite instance if the file exists; Otherwise returns null.

LoadSpriteFromTexture(Texture2D)

Creates a new Atlas.Sprite from an image file.
public static Atlas.Sprite LoadSpriteFromTexture(Texture2D texture2D)

Parameters

texture2D Texture2D
The 2D texture to convert into a sprite.

Returns

Atlas.Sprite
Will return a new Atlas.Sprite instance using the provided texture.

LoadTextureFromFile(string, TextureFormat)

Creates a new UnityEngine.Texture2D from an image file.
public static Texture2D LoadTextureFromFile(string filePathToImage, TextureFormat format = TextureFormat.BC7)

Parameters

filePathToImage string
The path to the image file.
format TextureFormat

The texture format. By default, this uses UnityEngine.TextureFormat.BC7.

https://docs.unity3d.com/ScriptReference/TextureFormat.BC7.html

Don't change this unless you really know what you're doing.

Returns

Texture2D
Will return a new UnityEngine.Texture2D instance if the file exists; Otherwise returns null.

Remarks

Ripped from: https://github.com/RandyKnapp/SubnauticaModSystem/blob/master/SubnauticaModSystem/Common/Utility/ImageUtils.cs