BGGG Creator Image2PSD
Use this skill to organize image assets into editable PSD raster layers. The core script is
, which does not depend on Photoshop or ImageMagick, and can independently generate PSD files with layer names, transparent channels and composite previews.
Default Codex Adaptation Strategy
When processing image-to-PSD conversion in Codex, it is combined with the capabilities of the
skill by default:
- First use Codex's visual understanding capabilities to determine the layer structure, boundaries of subject/background/text/decoration, and which areas need background reconstruction.
- If users require generation from descriptions, supplementing missing elements, filling backgrounds after removing objects, or extracting cleaner independent product/subject images, prioritize using the built-in generation/editing capabilities of the skill to generate project assets, then hand them over to this skill to assemble the PSD.
- If users explicitly request "no change to relative positions" or "direct splicing in Photoshop", retain the original image pixels as a priority: each layer is output as a full-canvas transparent PNG of the same size, only changing the alpha channel without redrawing content. Only background erasure/hole filling can use inpaint or imagegen assistance.
- Do not leave the default output of imagegen in . Images required for the project must be copied to the project directory of this skill.
Project Directory Convention
Create an independent project directory for each image processing task, placed under this skill's folder:
text
bggg-creator-image2psd/
└── projects/
└── YYYYMMDD_slug/
├── original_reference.png
├── manifest.json
├── layer_sources/
├── psd_full_canvas_layers/
├── output.psd
├── output.preview.png
├── psd_full_canvas_layers.zip
└── process_notes.md
Naming rules:
- uses the current date and a short English/pinyin task name, e.g.,
20260503_lifestyle_product
.
- is a copy of the source image for this processing task.
- stores transparent layer sources used for assembly.
- stores full-canvas PNG layers that can be directly stacked in their original positions in Photoshop.
- records layer division, whether imagegen was used, verification results and known limitations.
Workflow
-
Determine task type:
- Multiple element images already exist: copy to the project directory, use , and write the manifest in layer order.
- Only one flat image and need to retain relative positions: perform semantic/regional layer splitting, each layer maintains the same size as the original image; use inpaint or imagegen assistance to clean the area where layers were extracted for the background layer.
- Only one flat image and only need rough splitting: use to split layers by color clustering, and note that it is not semantic object splitting.
- User wants to generate PSD from description: first use Codex imagegen to generate project assets such as background, subject, text/decoration separately, then use to synthesize the PSD.
-
Create
, and place the source image and all outputs in it. Initialize with the script by default:
bash
python3 bggg-creator-image2psd/scripts/init_project.py lifestyle_product \
--source user_attachment.png \
--date 20260503
If imagegen is used, first copy the generated results under
to
of this project, then proceed to the layer splitting or synthesis process.
-
Determine canvas size. Prioritize using the source image size; for poster tasks, the width and height need to be clearly defined.
-
Handle transparency:
- Use for the background layer.
- is commonly used for logos, text, and decorative images.
- Use
remove_background: white-preserve
for elements like white sails, white products, and light-colored subjects that are easily obscured by white backgrounds.
- Use or for non-white solid backgrounds.
-
Run the script to output PSD, preview PNG, and optional single-layer PNG directory/zip.
-
Verify output: Check
in the script JSON summary, preview PNG, and PSD file size; check PSD readability with Pillow, Photoshop/Photopea.
-
Write
to record layers, paths, verification and limitations.
Common Commands
Synthesize from manifest:
bash
python3 bggg-creator-image2psd/scripts/image2psd.py assemble \
--manifest work/manifest.json \
--output work/output.psd \
--preview work/output.preview.png \
--save-layers work/layers \
--zip-layers work/layers.zip
Directly synthesize multiple images, with the first one as background:
bash
python3 bggg-creator-image2psd/scripts/image2psd.py assemble bg.png title.png logo.png \
--first-is-background \
--names "Background,Title,Logo" \
--output output.psd \
--save-layers layers
Split a single flat image into PSD layers by color:
bash
python3 bggg-creator-image2psd/scripts/image2psd.py split-colors poster.png \
--output poster-color-layers.psd \
--num-colors 10 \
--ignore-color white \
--save-layers poster-color-layers
Manifest Format
Use manifest to manage complex PSDs. The layer array is arranged from bottom to top.
json
{
"canvas": {
"width": 1122,
"height": 1402,
"composite_background": "#ffffff"
},
"output": "poster.psd",
"preview": "poster.preview.png",
"save_layers_dir": "layers",
"layers": [
{
"name": "Background",
"file": "assets/background.png",
"fit": "cover",
"remove_background": "none"
},
{
"name": "Ship and Waves",
"file": "assets/ship.png",
"remove_background": "white-preserve"
},
{
"name": "Title",
"type": "text",
"text": "AI Commerce Summit",
"x": 80,
"y": 120,
"font_size": 72,
"color": "#41270d",
"max_width": 900
}
]
}
Key layer fields:
- //: Image path, relative paths in the manifest are resolved from the directory where the manifest is located.
- : Render as an independent raster text layer using PIL, not an editable text object in Photoshop.
- , : Top-left offset of the image or text layer.
- : , , , .
- : , , , , .
- : 0 to 1.
Generation to PSD
In Codex, imagegen is treated as a supplementary tool by default, not the only processing method. Split the design into independent elements for generation or editing, instead of only generating a complete poster:
- Background: Full canvas, usually without background removal.
- Subject/product/character/ship/prop: White or transparent background, use or for background removal during synthesis.
- Logo, title, schedule, decoration: Try to generate separately or rebuild using the text layer of the manifest.
- The prompt for each element should include constraints such as canvas size, perspective, clean edges, no shadow pollution on the background, etc.
If only a complete image is obtained from generation, first use
to perform minimal layer splitting for editability, then supplement and generate key elements according to user needs.
Experience in Semantic Layer Splitting of Single Images
After reviewing successful cases, prioritize the following order for converting a single image to PSD:
- Copy the source image to the project directory, keeping the original size.
- First list the layer list, grouping by "background/subject/decoration/text/shadow or light effect".
- Output each movable object as a full-canvas transparent PNG without cropping the position, facilitating direct stacking in Photoshop.
- Use the union mask of the extracted layers to perform inpaint on the background layer, and expand the mask twice if necessary to clean residual shadows.
- Compare the preview image with the original image via pixel difference or visual inspection; if the edges of text/subjects are cropped, prioritize expanding the mask frame instead of moving the layer.
- If the source image has no local file, first ask the user to provide the source file path; do not use imagegen redrawn images as original layer splitting.
When to Read References
- Read
references/implementation-notes.md
before modifying the core script.
- Read
references/source-projects.md
when needing to trace inspiration from external projects.
- Do not use external repositories cloned under as runtime dependencies; they are only for development reference.
Output Requirements
At least explain the following during delivery:
- PSD path.
- Preview PNG path.
- Number of layers and main layer names.
- Whether single-layer PNG/zip was generated.
- Project directory path.
- If verification of Photoshop opening effect was not performed, clearly state that verification is limited to scripts and previews.