layer-image-editing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Layer Image Editing

Layer 图像编辑

Overview

概述

Editing is not generation with an image attached. Each intent maps to its own
use_case
, and picking the wrong one is the usual reason an edit changes things it should not have touched.
The user wants
filter.use_case
Attach
Change one region, keep the rest exact
inpainting
init_image
plus a
mask
Change the whole image by instruction
image_editing
init_image
Extend past the current frame
reframing
init_image
Fit another aspect ratio
reframing
init_image
The same subject from another angle
multi_angle
init_image
or
reference_image
Separate, editable layers
split_into_layers
init_image
Cut the subject out
background_removal
init_image
More pixels, same picture
upscaling
init_image
Clean line art into finished art
image_editing
lineart
or
scribble
A crisp SVG from a raster
vectorization
init_image
The loop and the spend gate are in the
layer
skill. 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.
编辑并不是附加一张图像后进行生成。每种意图都对应各自的
use_case
,选错通常是编辑结果意外影响了本应保持不变部分的原因。
用户希望
filter.use_case
需附加
修改一个区域,其余部分完全保持不变
inpainting
init_image
和
mask
根据指令修改整张图像
image_editing
init_image
扩展到当前画布之外
reframing
init_image
调整为其他宽高比
reframing
init_image
展示同一主体的另一个角度
multi_angle
init_image
或
reference_image
拆分为可单独编辑的图层
split_into_layers
init_image
将主体从背景中抠出
background_removal
init_image
增加像素数量,但保持画面不变
upscaling
init_image
将干净的线稿处理为成品艺术图
image_editing
lineart
或
scribble
从栅格图生成清晰的 SVG
vectorization
init_image
执行循环和费用控制逻辑位于
layer
skill 中。如果这里提到的某个同级 skill 不在可用 skills 中,请让用户安装它(
npx skills add layerai/skills --skill <name>
);在无人值守情况下,则根据 tool schemas 继续执行,并指出缺失项。

Edit from the source, not from the last edit

从源图编辑,而不是基于上一次编辑

Every edit pass is a fresh generation that re-renders the whole image, so each one drifts a little: colours shift, a face loses its likeness, a logo degenerates. Three passes stacked on each other look visibly worse than one pass that does all three things.
So when an edit is wrong, go back to the original and write a better instruction. Do not correct the correction. Output assets carry a
file_id
, so the original is always one argument away.
The exception is genuinely independent regions: masking the left lamp and then masking the right lamp touches disjoint pixels and stacks cleanly.
每一次编辑都会触发一次全新生成并重新渲染整张图像,因此每次都会产生轻微漂移:颜色变化、人脸失去相似度、标志退化。将三次编辑依次叠加,视觉效果明显比一次编辑同时完成这三项操作更差。
因此,当编辑结果不正确时,应回到原始图像并编写更好的指令。不要在上一次修正的基础上继续修正。输出资产带有
file_id
,因此只需传入一个参数即可取回原图。
例外情况是真正彼此独立的区域:先 mask 左侧的灯,再 mask 右侧的灯,修改的是互不相交的像素,能够干净地叠加。

Masks

Mask

A mask marks what may change. Supply it as an uploaded
file_id
, or use the
for_transparency
and
for_nontransparency
flags when the image's own alpha channel already describes the region, which saves authoring a mask by hand for an asset that is already cut out.
Mask edges matter. A hard-edged mask on a soft-edged subject leaves a halo. When the boundary is hair, smoke, or glass, prefer an instruction edit over a mask, because the model resolves the boundary better than your rectangle does.
Mask 用于标记允许发生变化的内容。可以将其作为已上传文件的
file_id
提供;如果图像自身的 alpha 通道已经描述了目标区域,也可以使用
for_transparency
和
for_nontransparency
标志,从而无需为已经抠出的资产手动制作 mask。
Mask 边缘很重要。在柔边主体上使用硬边缘 mask 会留下光晕。当边界是头发、烟雾或玻璃时,优先使用指令编辑而非 mask,因为模型对边界的处理比矩形 mask 更好。

What to hold constant

需要保持不变的内容

State it in the instruction. Models are literal about what you mention and careless about what you do not, so "change the banner to red, keep the pose, lighting, and armour exactly as they are" is a materially different instruction from "make the banner red". The clause costs six words and saves a reroll.
应在指令中明确说明。模型会严格处理你明确提到的内容,却容易忽略你没有提到的内容,因此“将横幅改为红色,保持姿势、光线和盔甲完全不变”与“将横幅改为红色”是实质上不同的指令。这个子句只增加六个词,却能省下一次重跑。

Angles are not a prompt trick

视角不是提示词技巧

"The same character from behind" appended to a text-to-image prompt produces a different character. Re-rendering an existing asset from another view needs
multi_angle
, a model whose capabilities report
camera_transform
, and the view supplied through the structured
camera
parameter, which orbits to side, back, or top, or zooms. Attach the source with the guidance type that model accepts.
在文生图 prompt 后追加“同一角色从背面看”会生成一个不同的角色。要从另一个视角重新渲染现有资产,需要使用
multi_angle
,选择其能力报告中包含
camera_transform
的模型,并通过结构化的
camera
参数提供目标视角;该参数可环绕至侧面、背面或顶部,也可进行缩放。应按照模型接受的 guidance type 附加源图。

Upscaling

Upscaling

Upscaling adds resolution without changing what the picture depicts. It must never route through a generation model: re-rendering at a larger size is a new image that merely resembles the approved one, and approved art has to survive the step unchanged. Use
filter.use_case: "upscaling"
.
Upscaling 用于增加分辨率,而不改变画面所描绘的内容。它绝不能通过生成模型处理:以更大尺寸重新渲染会生成一张仅仅与已批准版本相似的新图像,而已批准的艺术资产必须在此步骤中保持不变。使用
filter.use_case: "upscaling"
。

Layers

图层

split_into_layers
produces genuinely separate, independently editable elements, for rigging, parallax, or compositing. Before reaching for it, check what the user actually wants: "give me a PSD" usually means "give me the art with a transparent background", which is
background_removal
and far cheaper. Ask which one they mean when the request is ambiguous.
split_into_layers
会生成真正独立、可单独编辑的元素,适合 rigging、视差效果或合成。在使用它之前,先确认用户真正需要什么:“给我一个 PSD”通常意味着“给我一张带透明背景的艺术图”,这应该使用
background_removal
,成本也低得多。如果请求存在歧义,应询问用户具体指哪一种。

Worked example

实例

"Take this approved hero portrait and make a 9:16 version for the store."
  1. The intent is
    reframing
    , not a reroll of the portrait. Generating it again loses the approval.
  2. list_base_models
    with
    filter.use_case: "reframing"
    , take the first result.
  3. The portrait came from an earlier run, so it already has a
    file_id
    . No upload.
  4. estimate_forge_price
    with that file as
    init_image
    , the target ratio, and an instruction naming what must not change: "extend the scene above and below, keep the character, crop, and lighting untouched." Above 20 CUs, present the table and wait for an explicit yes.
  5. execute_forge
    with exactly those arguments, then poll
    get_forge_run
    at
    poll_interval_seconds
    .
  6. Present the result beside the original so the user can confirm the subject survived.
“将这张已批准的主角肖像制作成用于商店的 9:16 版本。”
  1. 该意图是
    reframing
    ,而不是重新生成肖像。再次生成会丢失已经获得的批准。
  2. 使用
    filter.use_case: "reframing"
    调用
    list_base_models
    ,选择第一个结果。
  3. 这张肖像来自之前的运行,因此已经拥有
    file_id
    ,无需上传。
  4. 使用该文件作为
    init_image
    ,并提供目标比例和一条明确说明哪些内容不得改变的指令,调用
    estimate_forge_price
    :“向上和向下扩展场景,保持角色、裁剪和光线不变。”费用超过 20 CU 时,展示价格表并等待用户明确同意。
  5. 使用完全相同的参数调用
    execute_forge
    ,然后按照
    poll_interval_seconds
    轮询
    get_forge_run
    。
  6. 将结果与原图并排展示,供用户确认主体是否保持不变。

Common mistakes

常见错误

  • Stacking edits on edits instead of returning to the source image.
  • Using
    image_editing
    when only one region should change, then explaining the collateral damage.
  • Omitting what must stay constant.
  • Appending "from behind" to a prompt instead of using
    multi_angle
    with
    camera
    .
  • Re-rendering an approved asset through a generation model to make it bigger.
  • Reaching for
    split_into_layers
    when the user just wants a transparent background.
  • Uploading an asset Layer already produced, which already has a
    file_id
    .
  • 在编辑结果上继续叠加编辑,而不是回到源图。
  • 本应只修改一个区域却使用
    image_editing
    ,然后再解释由此产生的附带变化。
  • 遗漏必须保持不变的内容。
  • 在 prompt 后追加“from behind”,而不是使用带有
    camera
    的
    multi_angle
    。
  • 通过生成模型重新渲染已批准的资产来放大图像。
  • 用户只是想要透明背景,却使用
    split_into_layers
    。
  • 上传 Layer 已经生成的资产,而该资产本来就带有
    file_id
    。