Skip to main content

CompressionQuality

Enum

Enum used to define the quality of image or texture compression.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Since Lens Scripting v285

Enum used to define the quality of image or texture compression. Higher quality typically results in larger file sizes. Used with Base64.

Index

Example

//@input Asset.Texture texture

//@input int compressionQuality = 0 {"widget" : "combobox", "values" : [{"label" : "MaximumCompression", "value" : "0"}, {"label" : "LowQuality", "value" : "1"}, {"label" : "IntermediateQuality", "value" : "2"}, {"label" : "HighQuality", "value" : "3"}, {"label" : "MaximumQuality", "value" : "4"}]}

//@input int encodingType = 0 {"widget" : "combobox", "values" : [{"label" : "Png", "value" : "0"}, {"label" : "Jpg", "value" : "1"}]}

Base64.encodeTextureAsync(script.texture, onSuccess, onFailure, script.compressionQuality, script.encodingType)

function onSuccess(encodedTexture) {
print("Encoded texture: " + encodedTexture)
}

function onFailure(error) {
print("Error: " + error)
}

Enumeration Members

HighQuality

HighQuality: number

Retains more details than lower settings.

Since

Lens Scripting Version 285


IntermediateQuality

IntermediateQuality: number

Balances quality and file size.

Since

Lens Scripting Version 285


LowQuality

LowQuality: number

Prioritizes smaller file size over quality.

Since

Lens Scripting Version 285


MaximumCompression

MaximumCompression: number

Optimizes for the smallest size, often sacrificing visual fidelity.

Since

Lens Scripting Version 285


MaximumQuality

MaximumQuality: number

Provides the highest quality, with the largest file size.

Since

Lens Scripting Version 285