layer-image

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Layer Image Generation

Layer 图像生成

Overview

概述

The loop is the one the
layer
skill teaches:
list_base_models
with
filter.use_case: "text_to_image"
,
get_base_model
, estimate, execute, poll. What separates a usable image from a near miss is the prompt and the per-model contract, not the model choice, which the curated ranking already handles.
Editing an image that already exists is a different use case with different rules: see
layer-image-editing
. Sprites, icons, and game UI have their own constraints: see
layer-game-assets
. Holding one look across a set: see
layer-reference-sets
.
If a sibling skill named here is missing from your available skills, ask the user to install it (
npx skills add layerai/skills --skill <name>
); unattended, proceed from tool schemas and flag the gap.
layer
skill 所教授的流程是:使用
list_base_models
并设置
filter.use_case: "text_to_image"
,然后依次执行
get_base_model
、估算、执行和轮询。决定图像 可用与否的关键是提示词和每个模型的契约,而不是模型选择;模型选择已由精选排序处理妥当。
编辑已有图像属于另一种用例,需要遵循不同的规则:请参阅
layer-image-editing
。Sprites、图标和游戏 UI 有各自的约束:请参阅
layer-game-assets
。在一组图片中保持统一风格:请参阅
layer-reference-sets
。
如果此处提到的同级 skill 不在可用 skill 列表中,请让用户安装 (
npx skills add layerai/skills --skill <name>
);在无人值守场景下,则根据工具 schema 继续操作,并标记该缺失项。

What a prompt must name

提示词必须明确的内容

A model fills every gap you leave, and it fills it with the most average answer in its training data. Each of these is a gap worth closing, in roughly this order of impact:
  1. Subject, concretely. "A dwarf blacksmith" beats "a fantasy character".
  2. Style register, as a production term rather than an artist's name: hand-painted, cel-shaded, flat vector, painterly semi-realism, stylised PBR render, gouache, 90s airbrush.
  3. Shot and framing: full body, three-quarter portrait, top-down, isometric, extreme close-up. This is the single most common omission and the most common cause of a reroll.
  4. Lighting: key direction, hardness, time of day, practical sources. "Rim-lit from behind, warm forge glow below" is a decision; "good lighting" is not.
  5. Palette, named or constrained: "muted teal and rust, two accent hues only".
  6. Background treatment: flat colour, isolated on transparent, environment implied, full scene. Assets that will be composited need this stated, not assumed.
Leave out what does not matter. A prompt that specifies everything specifies nothing, because the model weights the whole string and dilutes the parts you cared about.
模型会填补你留下的每一个空白,而且通常会用其训练数据中最平庸的答案来填补。以下这些空白都值得补齐,其影响程度大致按此顺序排列:
  1. 主体,要具体。“一位矮人铁匠”胜过“一个奇幻角色”。
  2. 风格类别,应使用制作术语,而不是艺术家姓名:手绘、赛璐璐上色、 扁平矢量、绘画式半写实、风格化 PBR 渲染、水粉、90 年代喷绘。
  3. 镜头与取景:全身、四分之三视角肖像、俯视、等距视角、特写。 这是最常被省略的信息,也是导致重新生成的最常见原因。
  4. 光照:主光方向、硬度、时间以及实际光源。“从后方形成轮廓光, 下方带暖色熔炉辉光”是一项明确决策,而“良好的光照”不是。
  5. 配色,应明确命名或加以限制:“低饱和青绿色与铁锈色,仅使用两种辅助色”。
  6. 背景处理:纯色、隔离在透明背景上、暗示环境存在或完整场景。 后续需要合成的素材必须明确说明这些要求,不能依赖默认行为。
不要描述无关紧要的内容。如果提示词指定了一切,也就等于什么都没指定,因为 模型会权衡整个字符串,从而稀释你真正关注的部分。

Sizing, and the fields that differ

尺寸,以及各模型不同的字段

Aspect ratio and resolution are per-model contracts. Two models that both do text-to-image disagree about whether they take an aspect ratio string, explicit width and height, or a fixed set of named sizes, so read
get_base_model
rather than reusing the shape that worked last time.
When the deliverable has a fixed ratio, filter for it.
filter.capabilities
is an object of booleans, not a list of names, so it is
{portrait_9_16: true}
:
square
,
portrait_9_16
,
landscape_16_9
, or
multiple_aspect_ratios
when the user will want several crops from one setup. Set only what the task needs, since
false
filters rather than defaults.
宽高比和分辨率由每个模型的契约决定。两个都支持 text-to-image 的模型,可能分别要求 宽高比字符串、明确的宽度和高度,或一组固定的命名尺寸,因此应读取
get_base_model
, 而不是沿用上次奏效的参数结构。
当交付物需要固定比例时,应按该比例筛选。
filter.capabilities
是一个布尔值对象, 而不是名称列表,因此应写成
{portrait_9_16: true}
:可使用
square
、
portrait_9_16
、
landscape_16_9
,或在使用者需要从同一设置中生成多种裁切比例时使用
multiple_aspect_ratios
。 只设置任务真正需要的字段,因为
false
表示过滤,而不是设置默认值。

Negatives, references, and seeds

负面提示、参考与种子

negative_prompt
is a capability, not a universal parameter. Filter for it when the run needs one, and do not send it blindly: on a model without it, it is either ignored or an error, and on a model with it, a long negative list costs more than it saves. Reach for it to suppress one specific, recurring defect.
Three reference types steer a text-to-image run, all passed through
guidance_files
after an upload:
  • reference_image
    with the
    image_editing
    capability, for "reproduce this subject" and for new art that has to match a reference.
    style_reference
    is the older style-only transfer: it moves a look across, it does not carry a subject, so reaching for it to hold a character is the usual reason a cast drifts.
  • pose
    with
    character_pose
    , for "put the character in this position".
  • depth
    ,
    canny
    ,
    lineart
    , or
    scribble
    with
    structure
    or
    outline
    , for "keep this layout".
A reference is worth more than three adjectives. When a user has an image and is describing it in words, upload the image.
Seeds make a run repeatable, which matters when iterating: hold the seed and change one clause to see what that clause actually does. They do not make two different prompts consistent with each other. For a look held across a set, train it: see
layer-reference-sets
.
negative_prompt
是一项能力,而不是通用参数。仅当本次生成需要它时才进行筛选, 不要盲目传入:对于不支持它的模型,该参数可能被忽略,也可能引发错误;对于支持它的模型, 冗长的负面提示列表通常成本大于收益。它适合用于抑制某一个具体且反复出现的缺陷。
有三种参考类型可以引导 text-to-image 任务,上传后均通过
guidance_files
传入:
  • reference_image
    配合
    image_editing
    能力,用于“复现这个主体”,以及生成必须与某张参考图匹配的新 艺术内容。
    style_reference
    是较早期的纯风格迁移方式:它可以迁移视觉风格, 但不会携带主体,因此试图用它来保持角色一致,正是角色群像经常发生风格漂移的原因。
  • pose
    配合
    character_pose
    ,用于“将角色置于这个姿势”。
  • depth
    、
    canny
    、
    lineart
    或
    scribble
    配合
    structure
    或
    outline
    ,用于“保留这个布局”。
一张参考图胜过三个形容词。当用户手中已有图像并试图用文字描述它时,应直接上传该图像。
种子可以让生成结果具备可重复性,这在迭代时很重要:保持种子不变,每次只修改一个子句, 以观察该子句实际产生的影响。种子无法让两个不同的提示词彼此保持一致。 如果需要在一组图片中保持统一风格,应训练该风格:请参阅
layer-reference-sets
。

Text in the image

图像中的文字

Most image models garble text. When the deliverable needs readable words, filter for a model whose description claims typography, keep the string short, and put it in quotes in the prompt. If it still fails after two attempts, stop rerolling: generate the art clean and composite the text, which is also what makes it editable and localisable later.
大多数图像模型无法准确生成文字。当交付物需要包含可读的词语时,应筛选描述中明确支持 typography 的模型,保持文本字符串简短,并在提示词中用引号将其标出。如果尝试两次后仍然失败, 不要继续重新生成:先生成不含文字的干净画面,再合成文字;这样也能让文字在之后保持可编辑和可本地化。

Worked example

实际示例

"Key art for our roguelike, 16:9, for the Steam page."
  1. list_base_models
    with
    filter.use_case: "text_to_image"
    and
    filter.capabilities: {landscape_16_9: true}
    . Take the first result.
  2. get_base_model
    , which reports the sizing fields it accepts and whether it needs a trigger word.
  3. Compose against the six points above: "Hooded rogue mid-leap over a collapsing stone bridge, seen three-quarter from below, hand-painted semi-realism, hard moonlight from the upper left with cold blue rim light, warm torchlight pooling below, muted slate and amber, storm-lit ruins receding into fog behind."
  4. estimate_forge_price
    with
    batch_size: 4
    , to see four compositions of one idea.
  5. Under 20 CUs, so execute, then poll at
    poll_interval_seconds
    .
  6. Present all four. Pick one, hold its seed, and iterate one clause at a time.
“用于我们 Roguelike 的主视觉,16:9,用于 Steam 页面。”
  1. 使用
    list_base_models
    ,设置
    filter.use_case: "text_to_image"
    和
    filter.capabilities: {landscape_16_9: true}
    。选择第一个结果。
  2. 使用
    get_base_model
    ,查看它接受的尺寸字段,以及是否需要触发词。
  3. 根据上述六点编写提示词:“披着兜帽的盗贼跃过正在坍塌的石桥,从下方以四分之三视角观察, 手绘半写实风格,左上方硬质月光配冷蓝色轮廓光,下方暖色火光汇聚,低饱和石板灰与琥珀色, 背后被风暴照亮的废墟渐隐入雾中。”
  4. 使用
    estimate_forge_price
    并设置
    batch_size: 4
    ,查看同一构想的四种方案。
  5. 如果低于 20 CUs,则执行生成,然后按照
    poll_interval_seconds
    进行轮询。
  6. 展示全部四张结果。选择其中一张,保持其种子不变,每次只迭代修改一个子句。

Common mistakes

常见错误

  • Omitting shot and framing, then rerolling the same prompt hoping for a different crop.
  • Describing a reference image in words instead of uploading it.
  • Sending
    negative_prompt
    to a model that does not declare the capability.
  • Reusing the sizing fields from a different model rather than reading
    get_base_model
    .
  • Using
    batch_size
    for N different assets. It makes variations of one prompt.
  • Chasing readable text through a sixth reroll instead of compositing it.
  • Stacking five style adjectives, which averages them into none of them.
  • 省略镜头与取景,然后反复使用同一提示词,希望得到不同的裁切结果。
  • 用文字描述参考图,而不是直接上传参考图。
  • 向未声明支持
    negative_prompt
    能力的模型传入该参数。
  • 沿用其他模型的尺寸字段,而不是读取
    get_base_model
    。
  • 使用
    batch_size
    一次生成 N 个不同素材;它只会生成同一提示词的变体。
  • 为了追求可读文字而进行第六次重新生成,而不是将文字合成到图像中。
  • 堆叠五个风格形容词,结果将它们平均化,最终失去所有风格特征。