import { PluginCommAPI } from 'sn-plugin-lib';
/**
* 生成贴纸缩略图的示例。
*/
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 调用失败');
}
const size = sizeRes.result;
const res = await PluginCommAPI.generateStickerThumbnail(stickerPath, thumbnailPath, size);
if (!res.success) {
throw new Error(res.error?.message ?? 'generateStickerThumbnail 调用失败');
}
return res.result;
}