This API belongs to
PluginNoteAPI and can only be called in NOTE.
Returns
APIResponse<boolean>:result === trueindicates the layer thumbnail image was generated successfully
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Generate a thumbnail image for a layer.
PluginNoteAPI and can only be called in NOTE.static generateLayerPreviewImage(
notePath: string,
page: number,
layer: number,
imagePath: string
): Promise<APIResponse<boolean>>;
| Parameter | Type | Description |
|---|---|---|
notePath | string | NOTE file path |
page | number | Page index (starts from 0) |
layer | number | Layer index. -1 indicates the background layer, 0 indicates the main layer, and 1~3 indicate custom layers |
imagePath | string | Output path for the thumbnail image |
APIResponse<boolean>:
result === true indicates the layer thumbnail image was generated successfullyimport { PluginNoteAPI } from 'sn-plugin-lib';
/**
* Example: generate a thumbnail image for a layer.
*/
export async function exampleGenerateLayerPreviewImage() {
const res = await PluginNoteAPI.generateLayerPreviewImage(
'/storage/emulated/0/Note/demo.note',
0,
0,
'/storage/emulated/0/Note/out/layer-preview.png'
);
if (!res.success) {
throw new Error(res.error?.message ?? 'generateLayerPreviewImage call failed');
}
return res.result;
}