Package-level declarations

Media transformer.

Transformer

Media transformer is designed to change the image using AI.

val photoManager: PhotoManager
val mediaTransformer: MediaTransformer = photoManager.mediaTransformer

Improve Media

val timeline: Timeline
val transformer: MediaTransformer
val mediaId = 0L

lifecycleScope.launch(Dispatchers.IO) {

// 1. Get Image Backend Url
val mediaContent: MediaItemContent = timeline.getMediaContent(mediaId)

// 2. Apply Transformation
val schema: TransformationInfoSchema = transformer.applyAiTransformation(
fileUrl = mediaContent.dataUrl!!,
fileName = mediaContent.fileName,
type = TransformationType.GFPGNType
)

// 3. Save as desired
val mediaId: Long = transformer.addTransformedPhotoToCloud(
mediaId
)
}

Remove Objects From Media

val timeline: Timeline
val transformer: MediaTransformer
val mediaId = 0L

lifecycleScope.launch(Dispatchers.IO) {

// 1. Get Image Backend Url
val mediaContent: MediaItemContent = timeline.getMediaContent(mediaId)

// 2. Apply Transformation
val schema: TransformationInfoSchema = transformer.applyAiTransformation(
fileUrl = mediaContent.dataUrl!!,
fileName = mediaContent.fileName,
type = TransformationType.Lama(
mediaMask = "", // Media mask in base64
mediaMaskMimeType = "" // `image/png` for example
)
)

// 3. Save as desired
val mediaId: Long = transformer.addTransformedPhotoToCloud(
mediaId
)
}

Types

Link copied to clipboard
Link copied to clipboard
sealed class TransformationType