LottieImage
ImageOptions
export interface ImageOptions { data?: ImageData; fileName: string; id: string; parentAnimation?: LottieAnimationCommon[]; url?: string;}data?: ImageDataImage data of the image. Can be of type: string | ArrayBuffer | Blob
fileName: stringMandatory file name of the image asset.
id: stringMandatory id of the image asset.
parentAnimation?: LottieAnimationThe LottieAnimation to which belongs the LottieImage.
url?: stringOptional URL to the image.
Methods
Export and util methods
renameImage(newName: string): voidRenames the id and file name to newName.
async generatePhash(): Promise<string>Returns a generated string of 1s and 0s resulting from the dhash algorithm if used on a browser environment, or the phash algorithm if used in a Node environment.
async toDataURL(): Promise<string>Returns the image as a Base64 encoded string.
async toArrayBuffer(): Promise<ArrayBuffer>Returns the image as an ArrayBuffer.
async toBlob(): Promise<Blob>Returns the image as a Blob.
async distanceTo(imageToCompare: LottieImage): Promise<number>Calculates the distance of hash values between the current LottieImage and imageToCompare.