在 Cowart 画布中生成并插入或替换指定尺寸的 AI 图片。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "cowart-image-gen" 技能: 1. 下载 https://raw.githubusercontent.com/zhongerxin/Cowart/main/skills/cowart-image-gen/SKILL.md 2. 保存为 ~/.claude/skills/cowart-image-gen/SKILL.md 3. 装好后重载技能,告诉我可以用了
设计师在 Cowart 模板中预先放好 AI 图片占位框后,可用此技能按槽位尺寸生成并替换最终图片,减少手动裁切和对齐。
当页面上没有专门的图片占位框时,用户仍可直接生成图片并插入当前 Cowart 页面,用于概念稿、提案或灵感探索。
市场或产品团队需要指定画面比例并在图内加入文字时,可让技能直接生成适配画布的最终位图。
文档介绍了如何在 Cowart 画布中使用该技能生成 AI 图片,并说明两种流程:选中 AI 图片占位框时按其宽高与比例生成后替换;未选中时直接把图片插入当前页面。文档还列出前置条件、占位框识别方式,以及通过 Cowart MCP 工具读取选择状态与页面信息的方法。
Use this skill when the user wants an AI-generated image placed onto the Cowart canvas. A selected AI 图片 holder gives a precise size and placement target, but it is not required. By default, a selected holder is a temporary target and should be replaced by the generated image.
The native Cowart widget should be open for the user's active project. Cowart state is read and written through Cowart MCP tools, not through a localhost browser service.
New holders are tldraw frame shapes with:
{
"type": "frame",
"meta": {
"cowartAiImageHolder": true
}
}
Older canvases may still contain legacy geo rectangle holders with the same
meta flag. Support both shapes.
Read the selected shape from Cowart with the MCP get_cowart_selection tool. Pass the active user project directory as projectDir.
Check whether exactly one selected shape is an AI image holder. A holder is any selected shape with either:
isAiImageHolder: true
or:
meta.cowartAiImageHolder: true
If yes, use the holder replacement workflow below. If not, do not ask the user to select a holder; use the standalone workflow below and insert the generated image into the current Cowart page.
Choose the placement workflow.
Holder replacement workflow: use the selected holder's props.w and props.h as the size contract for both generation and placement. Before generating, derive and keep these values:
targetWidth: selected holder props.wtargetHeight: selected holder props.htargetAspectRatio: the reduced targetWidth:targetHeight ratio when it maps cleanly, plus the decimal targetWidth / targetHeightIf the selected holder matches a Cowart ratio preset such as 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, or 9:16, use that preset label as the human-readable aspect ratio. The generated image should be composed for this target size and aspect ratio, and should not rely on later stretching or cropping to fit the holder.
The generated image should replace the selected holder as a normal tldraw image shape:
parentId: same parent as the holderx, y, rotation: same as the holderprops.w, props.h: same as the holderThis leaves the final canvas with an image shape at the holder's position, not an AI holder that contains an image. Only preserve the holder when the user explicitly asks to keep the reusable slot.
Standalone workflow: when no AI holder is selected, generate the image anyway and insert it as a normal image shape on the current page. Prefer the current page from Cowart view state; if there is a selected non-holder shape and it is useful as context, place the image beside it, otherwise place it in a clear page area. If the user requested a size or aspect ratio, pass that size and ratio into generation and use it for display. Otherwise, use the generated bitmap's natural aspect ratio and a practical display width such as 512 canvas units.
Generate the bitmap with the built-in imagegen skill unless the user explicitly requests another image path. If the requested asset needs visible copy, labels, poster text, ad text, UI text, or typography, include that text directly in the image generation prompt and let the image model produce the final bitmap. Do not default to generating a text-free background and then adding text locally unless the user explicitly asks for local typography, deterministic text overlay, SVG/vector output, or another non-imagegen layout step.
For the holder workflow, the image generation request must explicitly include the selected holder's target size and aspect ratio. Add this information to the model prompt, for example:
Target canvas slot: 512 x 683 canvas units.
Target aspect ratio: 3:4 (0.75 width/height).
Compose the final bitmap for this portrait ratio so it fits the slot without cropping or stretching.
…
它用于在 Cowart 画布上生成 AI 图片,并将图片插入当前页面,或默认替换选中的 AI 图片占位框。它也支持按用户要求在图内加入文字。
文档说明需要打开用户当前项目的原生 Cowart 组件。Cowart 状态通过 Cowart MCP 工具读写,而不是通过 localhost 浏览器服务。
不必须。若恰好选中了一个 AI 图片占位框,技能会默认按该槽位的尺寸、位置和比例生成并替换;否则会直接生成图片并插入当前页面。
帮助用户生成或编辑位图图像,用于插画、照片、贴图与透明抠图等视觉素材。
帮助用户创作海报、插画与静态视觉稿,并输出PNG或PDF文件
将文本、网址或PDF快速生成专业海报、轮播图与演示文稿
根据文字提示快速生成图像,适合在对话中完成创意出图与视觉草稿。
在 Claude 中生成与编辑图片,并快速制作短视频素材。
通过自然语言生成或编辑图片,快速完成创意视觉制作。