Returns the color space (if any) implied by the Material slots to which a texture is assigned, or null for non-color textures. If the texture is not connected to any Material, this function will also return null — any metadata in the image file will be ignored.
Under current glTF specifications, only 'srgb' and non-color (null) textures are used.
Example:
import { getTextureColorSpace } from '@gltf-transform/functions';
const baseColorTexture = material.getBaseColorTexture();
const normalTexture = material.getNormalTexture();
getTextureColorSpace(baseColorTexture); // → 'srgb'
getTextureColorSpace(normalTexture); // → null
Made by Don McCurdy • Documented with greendoc • © 2023 MIT License
getTextureColorSpace