TextureCompressOptions

Properties

effort: number | null

Level of CPU effort to reduce file size, 0-100. PNG, WebP, and AVIF only. Supported only when a Sharp encoder is provided. Default: auto.

encoder: unknown

Instance of the Sharp encoder, which must be installed from the 'sharp' package and provided by the caller. When not provided, a platform-specific fallback implementation will be used, and most quality- and compression-related options are ignored.

formats: RegExp | null

Pattern matching the format(s) to be compressed or converted. Some examples of formats include "jpeg" and "png".

limitInputPixels: boolean
  • experimental

Attempts to avoid processing images that could exceed memory or other other limits, throwing an error instead. Default: true.

lossless: boolean

Use lossless compression mode. WebP and AVIF only. Supported only when a Sharp encoder is provided. Default: false.

nearLossless: boolean

Use near lossless compression mode. WebP only. Supported only when a Sharp encoder is provided. Default: false.

pattern: RegExp | null

Pattern identifying textures to compress, matched to name or URI.

quality: number | null

Quality, 1-100. Default: auto.

resize: vec2 | 'nearest-pot' | 'ceil-pot' | 'floor-pot'

Resizes textures to given maximum width/height, preserving aspect ratio. For example, a 4096x8192 texture, resized with limit [2048, 2048] will be reduced to 1024x2048.

Presets "nearest-pot", "ceil-pot", and "floor-pot" resize textures to power-of-two dimensions, for older graphics APIs including WebGL 1.0.

resizeFilter: TextureResizeFilter

Interpolation used if resizing. Default: TextureResizeFilter.LANCZOS3.

slots: RegExp | null

Pattern matching the material texture slot(s) to be compressed or converted. Some examples of slot names include "baseColorTexture", "occlusionTexture", "metallicRoughnessTexture", and "normalTexture".

targetFormat: Format

Target image format. If specified, included textures in other formats will be converted. Default: original format.

Function symbol, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.