Documentation Index
Fetch the complete documentation index at: https://docs.supernote.com/llms.txt
Use this file to discover all available pages before exploring further.
static generateStickerThumbnail(
stickerPath: string,
thumbnailPath: string,
size: Size
): Promise<APIResponse<boolean>>;
参数
| 参数 | 类型 | 说明 |
|---|
stickerPath | string | 贴纸源文件路径 |
thumbnailPath | string | 缩略图输出路径(通常为 .png) |
size | Size | 缩略图尺寸(需与原图保持等比例),可以通过 getStickerSize这个接口获取贴纸的尺寸 |
返回
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;
}