Skip to main content

ImageUploadOptions

Class

Provides configuration options for uploading images via RemoteMediaModule.uploadImage.

  • 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.

Provides configuration options for uploading images via RemoteMediaModule.uploadImage. Allows setting the compression method, compression quality, and whether to include alpha channel.

Index

Example

// @input Asset.RemoteMediaModule remoteMediaModule
// @input Asset.Texture texture

var uploadOptions = ImageUploadOptions.create();
uploadOptions.compressionMethod = ImageUploadCompressionMethod.JPG;
uploadOptions.compressionQuality = CompressionQualityLevel.HighQuality;
// Note: Set includeAlpha last to avoid conflicts with compressionMethod.
// Alpha is not supported for JPG comrpession.
uploadOptions.includeAlpha = false;

script.remoteMediaModule.uploadImage(
script.texture,
function(resource) {
print("Image uploaded successfully");
},
function(error) {
print("Upload failed: " + error);
},
uploadOptions
);

Extends

Properties

compressionMethod

compressionMethod: ImageUploadCompressionMethod

The compression method (image format) to use when encoding the image.

Default Value

ImageUploadCompressionMethod.JPG

compressionQuality

compressionQuality: CompressionQuality

The compression quality level to use when encoding the image.

Default Value

CompressionQuality.MaximumQuality

includeAlpha

includeAlpha: boolean

Whether to include the alpha channel in the uploaded image. Note: This property must be set after compressionMethod to avoid conflicts. Alpha channel is not supported for JPG format.

Default Value

false

Methods

create()

static create(): ImageUploadOptions

Creates a new ImageUploadOptions instance with default settings.

Returns

ImageUploadOptions

Since

Lens Scripting Version 353


getTypeName()

static getTypeName(): TypeName<ImageUploadOptions>

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<ImageUploadOptions>

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame