emojigen-nano-banana

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

EmojiGen Nano Banana

EmojiGen Nano Banana

Use this skill to reproduce the EmojiGen Pro workflow as a reusable agent workflow instead of a browser app.
Read this skill end to end before you start work. Do not jump straight to writing a config, building a prompt, or calling a model until you have read the SOP and decided how you will satisfy every step.
使用本技能可将EmojiGen Pro工作流复刻为可复用的Agent工作流,无需依赖浏览器应用。
开始操作前请通读本技能说明,在阅读完标准操作流程(SOP)并确认你能完成每一步要求之前,不要直接编写配置、构建提示词或调用模型。

What to collect before doing work

工作前需要收集的信息

Do not start generation until you have either explicit answers or safe defaults for:
  1. Reference image path.
  2. Output mode:
    animated
    or
    static
    .
  3. Emotion list, or a category prompt that can be expanded into emotions.
  4. Style target, such as
    皮克斯 3D
    ,
    吉卜力
    ,
    Q版 LINE
    .
  5. Optional custom text and color.
  6. Output directory.
  7. Backend choice:
    • Gemini Developer API via
      GEMINI_API_KEY
      ,
      GOOGLE_API_KEY
      , or
      API_KEY
    • Vertex AI via
      GOOGLE_GENAI_USE_VERTEXAI=true
      plus
      GOOGLE_CLOUD_PROJECT
      and
      GOOGLE_CLOUD_LOCATION
    • Another image tool chosen by the agent when Gemini access is unavailable
Before generation, inspect the current reference image and rewrite
characterNotes
for this exact subject. Never reuse stale
characterNotes
,
propNotes
, or style notes from a previous run on a different person.
If the user is adapting the original EmojiGen Pro repository, first reconstruct the workflow from the codebase before you rewrite anything. Preserve the original sequence:
  1. Collect or generate emotion labels.
  2. Assemble one long prompt for a strict 4x6 sticker sheet.
  3. Generate the sheet image from the reference image.
  4. Slice the sheet into frames or stickers.
  5. Encode GIFs for animated mode.
在确认以下信息的明确答案或安全默认值之前,不要启动生成流程:
  1. 参考图像路径。
  2. 输出模式:
    animated
    (动态)或
    static
    (静态)。
  3. 情绪列表,或可扩展为情绪的分类提示词。
  4. 风格目标,例如
    皮克斯 3D
    吉卜力
    Q版 LINE
  5. 可选的自定义文本和颜色。
  6. 输出目录。
  7. 后端选择:
    • 通过
      GEMINI_API_KEY
      GOOGLE_API_KEY
      API_KEY
      调用Gemini开发者API
    • 配置
      GOOGLE_GENAI_USE_VERTEXAI=true
      GOOGLE_CLOUD_PROJECT
      GOOGLE_CLOUD_LOCATION
      调用Vertex AI
    • 无法访问Gemini时,由Agent选择其他图像工具
生成前,请检查当前参考图像,为当前对象重写
characterNotes
。切勿复用之前针对其他对象生成的过时
characterNotes
propNotes
或风格说明。
如果用户需要适配原版EmojiGen Pro仓库,在重写任何内容前,请先从代码库中还原原有工作流,保留原始执行顺序:
  1. 收集或生成情绪标签。
  2. 为严格的4x6贴纸表组装完整长提示词。
  3. 基于参考图像生成贴纸表图像。
  4. 将贴纸表切割为单帧或单张贴纸。
  5. 动态模式下编码为GIF。

Default decisions

默认配置规则

  • Only use these image models:
    • Nano Banana Pro
      ->
      gemini-3-pro-image-preview
    • Nano Banana 2
      ->
      gemini-3.1-flash-image-preview
  • Default to
    Nano Banana Pro
    unless the user explicitly asks for
    Nano Banana 2
    .
  • Default style:
    皮克斯 3D
  • Default
    removeBackground
    :
    false
  • Random emotions should be generated by the agent locally by default. Do not depend on a Gemini text model unless the user explicitly wants model-generated wording.
  • Keep count constraints hard:
    • static mode always resolves to exactly
      24
      stickers
    • animated mode only allows
      1
      ,
      2
      , or
      4
      GIFs
  • Force image generation settings to:
    • aspect ratio
      3:2
    • image size
      2K
  • Keep the output contract stable even if image generation uses a fallback tool:
    • prompt.txt
    • resolved-config.json
    • grid.*
    • extracted
      stickers/
    • manifest.json
  • 仅允许使用以下图像模型:
    • Nano Banana Pro
      对应
      gemini-3-pro-image-preview
    • Nano Banana 2
      对应
      gemini-3.1-flash-image-preview
  • 除非用户明确要求使用
    Nano Banana 2
    ,否则默认使用
    Nano Banana Pro
  • 默认风格:
    皮克斯 3D
  • 默认
    removeBackground
    (移除背景)配置:
    false
  • 默认由Agent本地生成随机情绪,除非用户明确要求由模型生成措辞,否则不要依赖Gemini文本模型。
  • 严格遵守数量约束:
    • 静态模式固定生成
      24
      张贴纸
    • 动态模式仅允许生成
      1
      2
      4
      个GIF
  • 强制使用以下图像生成设置:
    • 宽高比
      3:2
    • 图像尺寸
      2K
  • 即使使用备用工具生成图像,也要保持输出约定稳定:
    • prompt.txt
    • resolved-config.json
    • grid.*
      (网格图文件)
    • 提取出的
      stickers/
      目录
    • manifest.json

Working sequence

工作流程

0. Stage the source image when the path is unstable

0. 路径不稳定时暂存源图像

If the image came from the clipboard, a pasted chat image, or any source whose original path is unreliable, save it into
/tmp
first:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs stage-image \
  --from-clipboard
Or copy a known file into
/tmp
so later steps use a stable path:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs stage-image \
  --input /abs/path/to/source.png
Use the staged path for all later steps.
如果图像来自剪贴板、聊天粘贴的图片,或其他原始路径不可靠的来源,请先保存到
/tmp
目录:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs stage-image \
  --from-clipboard
或者将已知文件复制到
/tmp
,确保后续步骤使用稳定路径:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs stage-image \
  --input /abs/path/to/source.png
后续所有步骤都使用暂存后的路径。

1. Prepare config

1. 准备配置

Start from
assets/example-config.json
. Fill only the fields needed for the current task.
If the user did not give an emotion list, leave
emotions
empty and provide
categoryPrompt
.
Then:
  • infer a category prompt from the request and let the agent produce the random emotions directly, or
  • only if the user explicitly wants model-generated wording, run:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs suggest-emotions \
  --category "职场打工人, 加班, 摸鱼, 收到, 崩溃, 阴阳怪气" \
  --count 4
基于
assets/example-config.json
启动配置,仅填写当前任务需要的字段。
如果用户没有提供情绪列表,将
emotions
留空,填入
categoryPrompt
即可。
接下来:
  • 从用户请求中推断分类提示词,由Agent直接生成随机情绪,或者
  • 仅当用户明确要求模型生成措辞时,执行:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs suggest-emotions \
  --category "职场打工人, 加班, 摸鱼, 收到, 崩溃, 阴阳怪气" \
  --count 4

2. Run preflight before generation

2. 生成前执行预检

Preflight checks the backend, confirms the staged reference path, and resolves missing random emotions without starting image generation:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs preflight \
  --config path/to/config.json \
  --reference /tmp/emojigen-input-123.png
预检会检查后端配置、确认暂存的参考路径、补全缺失的随机情绪,不会启动图像生成:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs preflight \
  --config path/to/config.json \
  --reference /tmp/emojigen-input-123.png

3. Build the prompt

3. 构建提示词

Always build the prompt through the script so the wording stays consistent:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs build-prompt \
  --config path/to/config.json \
  --out path/to/output/prompt.txt
Do not stop here.
build-prompt
is not the delivery workflow.
始终通过脚本构建提示词,保证措辞一致性:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs build-prompt \
  --config path/to/config.json \
  --out path/to/output/prompt.txt
不要在这一步停止,
build-prompt
不是交付工作流的终点。

4. Generate the 4x6 grid

4. 生成4x6网格图

If Gemini or Vertex AI is available, prefer the built-in generator:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs generate-grid \
  --config path/to/config.json \
  --reference path/to/reference.png \
  --out path/to/output/grid.png
The script rejects image models outside
Nano Banana Pro
and
Nano Banana 2
, and always sends
3:2
+
2K
.
Do not take
prompt.txt
and call a raw image model yourself when the built-in workflow is available. That bypasses the skill's staging, preflight, slicing, background-removal, and quality gates.
If another image tool is a better fit, still use this skill. Build the prompt with this skill, generate the grid elsewhere, then continue with
make-assets
.
如果可以使用Gemini或Vertex AI,优先使用内置生成器:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs generate-grid \
  --config path/to/config.json \
  --reference path/to/reference.png \
  --out path/to/output/grid.png
脚本会拒绝
Nano Banana Pro
Nano Banana 2
之外的图像模型,且始终传递
3:2
宽高比和
2K
尺寸参数。
内置工作流可用时,不要自行读取
prompt.txt
调用原生图像模型,这会绕过本技能的暂存、预检、切割、背景移除和质量校验环节。
如果其他图像工具更适配需求,仍然可以使用本技能:先用本技能构建提示词,在其他工具生成网格图后,继续执行
make-assets
步骤即可。

5. Produce GIFs or static stickers

5. 生成GIF或静态贴纸

If you already have a grid image, run:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs make-assets \
  --config path/to/config.json \
  --grid path/to/output/grid.png \
  --out-dir path/to/output
This creates square crops, optional background removal, and GIF outputs for animated mode.
Keep
removeBackground: false
by default. Only enable background removal when the user explicitly wants transparent stickers and the generated sheet clearly uses a flat, separable background.
Read
manifest.json
after
make-assets
or
run
. If
manifest.quality.status
is
warn
, do not deliver the result yet. Rerun with stricter
characterNotes
, stronger square-safe composition constraints, or
removeBackground: false
.
Background removal uses a corner-connected flood-fill strategy. This is safer than making every near-background color transparent, and avoids punching holes in faces or clothing when skin tones are similar to the background.
Treat square-safe composition as a hard requirement, not a style preference. The final assets are cropped to square cells, so the subject must stay centered and stable across frames or the GIF will jitter after slicing.
如果已经有网格图,执行:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs make-assets \
  --config path/to/config.json \
  --grid path/to/output/grid.png \
  --out-dir path/to/output
该命令会生成正方形裁切图、可选的背景移除处理,以及动态模式下的GIF输出。
默认保持
removeBackground: false
,仅当用户明确要求透明贴纸,且生成的贴纸表使用了平坦、可分离的背景时,才启用背景移除。
执行
make-assets
run
后请读取
manifest.json
,如果
manifest.quality.status
warn
,暂不要交付结果,使用更严格的
characterNotes
、更强的正方形安全构图约束,或设置
removeBackground: false
重新运行。
背景移除采用角落连通的漫水填充策略,比将所有接近背景的颜色设为透明更安全,可避免当肤色与背景接近时,在面部或衣物上产生透明孔洞。
正方形安全构图是硬性要求,不是风格偏好:最终资源会被裁切为正方形单元格,主体必须在各帧中保持居中稳定,否则切割后GIF会产生抖动。

6. Full end-to-end run

6. 完整端到端运行

When no step needs manual intervention, use the orchestration command:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs run \
  --config path/to/config.json \
  --reference path/to/reference.png \
  --out-dir /tmp/emojigen-run \
  --deliver-dir path/to/workspace-output \
  --cleanup-temp
Use
--deliver-dir
to copy the finished assets into the working directory or a client delivery folder.
Use
--cleanup-temp
after delivery when the outputs were generated under
/tmp/emojigen-*
. macOS may eventually clear
/tmp
, but not immediately enough for agent workflows.
Treat this as the preferred path. The default expectation is:
  1. stage-image
  2. preflight
  3. run
  4. inspect
    manifest.quality
  5. deliver only if quality is acceptable
Do not skip any of these steps unless the user explicitly narrows the task and you can still preserve output quality.
如果所有步骤都不需要人工干预,使用编排命令:
bash
node skills/emojigen-nano-banana/scripts/emojigen.mjs run \
  --config path/to/config.json \
  --reference path/to/reference.png \
  --out-dir /tmp/emojigen-run \
  --deliver-dir path/to/workspace-output \
  --cleanup-temp
使用
--deliver-dir
将完成的资源复制到工作目录或客户交付文件夹。
交付后如果输出生成在
/tmp/emojigen-*
目录下,使用
--cleanup-temp
清理临时文件。macOS最终会自动清空
/tmp
,但对于Agent工作流来说清理不够及时。
推荐优先使用该路径,默认执行顺序为:
  1. stage-image
    (暂存图像)
  2. preflight
    (预检)
  3. run
    (运行全流程)
  4. 检查
    manifest.quality
    (质量校验)
  5. 质量合格才交付
除非用户明确缩小了任务范围且你能保证输出质量,否则不要跳过任何步骤。

Fallback rules

回退规则

  • If no Gemini credentials are present, say that explicitly and either ask for credentials or use another image-capable tool.
  • If another tool generated the grid, say that the final GIF packaging still came from this skill.
  • If background removal damages line art or text, rerun with
    removeBackground: false
    and keep the pure solid background from prompt-time constraints.
  • Do not proactively enable background removal just because the script supports it.
  • If the input image arrived as a pasted or clipboard image, stage it to
    /tmp
    before any prompt or generation step.
  • If the user only asked for random emotions, do not call a text model by default. Generate them directly unless the user explicitly wants a model to brainstorm them.
  • 如果没有Gemini凭证,明确告知用户,可索要凭证或使用其他支持图像生成的工具。
  • 如果网格图由其他工具生成,说明最终GIF打包仍由本技能完成。
  • 如果背景移除损坏了线稿或文本,设置
    removeBackground: false
    重新运行,保留提示词约束生成的纯色背景。
  • 不要仅因为脚本支持背景移除就主动启用该功能。
  • 如果输入图像是粘贴或来自剪贴板的图像,在任何提示词构建或生成步骤前,先将其暂存到
    /tmp
    目录。
  • 如果用户仅要求生成随机情绪,默认不要调用文本模型,直接生成即可,除非用户明确要求由模型 brainstorm 情绪。

References

参考资料

  • Read
    references/workflow.md
    for CLI usage, environment variable precedence, and output layout.
  • Read
    references/model-backends.md
    when choosing between Gemini API and Vertex AI.
  • 阅读
    references/workflow.md
    了解CLI用法、环境变量优先级和输出目录结构。
  • 选择Gemini API和Vertex AI时,阅读
    references/model-backends.md