docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ImageFormatDetection

    Methods for detecting image formats from byte data.

    Inheritance
    object
    ImageFormatDetection
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: GLTFast
    Assembly: glTFast.dll
    Syntax
    public static class ImageFormatDetection

    Methods

    IsJpeg(ReadOnlySpan<byte>)

    Determines if the data is in Jpeg format.

    Declaration
    public static bool IsJpeg(ReadOnlySpan<byte> data)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> data

    Image data. Can be the first 3 bytes only.

    Returns
    Type Description
    bool

    True if the data is Jpeg, false otherwise.

    IsKtx(ReadOnlySpan<byte>)

    Determines if the data is in KTX format.

    Declaration
    public static bool IsKtx(ReadOnlySpan<byte> data)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> data

    Image data. Can be the first 12 bytes only.

    Returns
    Type Description
    bool

    True if the data is KTX, false otherwise.

    IsPng(ReadOnlySpan<byte>)

    Determines if the data is in PNG format.

    Declaration
    public static bool IsPng(ReadOnlySpan<byte> data)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> data

    Image data. Can be the first 8 bytes only.

    Returns
    Type Description
    bool

    True if the data is PNG, false otherwise.

    IsPngOrJpeg(ReadOnlySpan<byte>)

    Determines if the data is in PNG or Jpeg format.

    Declaration
    public static bool IsPngOrJpeg(ReadOnlySpan<byte> data)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> data

    Image data. Can be the first 8 bytes only.

    Returns
    Type Description
    bool

    True if the data is PNG or Jpeg, false otherwise.

    IsWebP(ReadOnlySpan<byte>)

    Determines if the data is in WebP format.

    Declaration
    public static bool IsWebP(ReadOnlySpan<byte> data)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> data

    Image data. Can be the first 12 bytes only.

    Returns
    Type Description
    bool

    True if the data is WebP, false otherwise.

    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)