Skip to main content
static generateStickerThumbnail(
 stickerPath: string,
 thumbnailPath: string,
 size: Size
): Promise<APIResponse<boolean>>;
Parameters
ParameterTypeDescription
stickerPathstringSticker source file path
thumbnailPathstringThumbnail output path (usually .png)
sizeSizeThumbnail size (keep the original aspect ratio). You can get it via getStickerSize.
Returns

Example

import { PluginCommAPI } from 'sn-plugin-lib';

/**
 * Example: generate a sticker thumbnail.
 */
export async function exampleGenerateStickerThumbnail() {
 const stickerPath = '/storage/emulated/0/Note/stickers/demo.sticker';
 const thumbnailPath = '/storage/emulated/0/Note/stickers/demo_thumb.png';
 const sizeRes = await PluginCommAPI.getStickerSize(stickerPath);
 if (!sizeRes.success || !sizeRes.result) {
 throw new Error(sizeRes.error?.message ?? 'getStickerSize call failed');
 }
 const size = sizeRes.result;

 const res = await PluginCommAPI.generateStickerThumbnail(stickerPath, thumbnailPath, size);
 if (!res.success) {
 throw new Error(res.error?.message ?? 'generateStickerThumbnail call failed');
 }
 return res.result;
}