> ## 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.

# generateLassoPreview

> 生成套索元素的预览图片数据。

```ts wrap theme={null}
static generateLassoPreview(imagePath: string): Promise<APIResponse<LassoPreview>>;
```

**参数**

| 参数          | 类型       | 说明       |
| ----------- | -------- | -------- |
| `imagePath` | `string` | 预览图片输出路径 |

**返回**

* [`APIResponse<T>`](/zh/api-reference/supernote-plugin/types/api-response)：`result` 为套索预览数据对象，结构如下：

| 字段             | 类型                                                      | 说明        |
| -------------- | ------------------------------------------------------- | --------- |
| `imagePath`    | `string`                                                | 生成的预览图片路径 |
| `rect`         | [`Rect`](/zh/api-reference/supernote-plugin/types/rect) | 套索区域      |
| `rotateDegree` | `number`                                                | 旋转角度      |

## 示例

```ts wrap theme={null}
import { PluginCommAPI } from 'sn-plugin-lib';

/**
 * 生成套索元素预览图的示例。
 */
export async function exampleGenerateLassoPreview() {
  const res = await PluginCommAPI.generateLassoPreview('/storage/emulated/0/Note/out/lasso-preview.png');
  if (!res.success) {
    throw new Error(res.error?.message ?? 'generateLassoPreview 调用失败');
  }
  return res.result;
}
```
