How to Batch-Render Separate Blender Clothing Objects as Named Transparent PNGs
To batch-render separate clothing objects in Blender, keep a fixed camera and lighting setup, show one garment per render, enable transparent film, and save each result as an RGBA PNG. A Python loop can repeat those steps and derive each filename from its object name.
This workflow is for a Blender user who already has separate garment meshes and wants individual cutouts with consistent framing. The example uses three fictional objects—Canvas Jacket, Knit Vest, and Pocket Apron—and produces one named image for each at the current frame. It targets Blender 4.5’s API.
Decide whether the images need shared alignment
Choose the image layout before automating. For clothing layers that must line up when stacked, preserve every object’s position, the camera, and the canvas dimensions. For separate catalog thumbnails, you may prefer each garment centered and similarly sized; that requires a framing step beyond the fixed-camera script below.
| Intended result | Preparation | Expected appearance |
|---|---|---|
| Aligned clothing layers | Keep the original positions and one camera | Every garment occupies its original place on an identical canvas |
| Comparable garment previews | Arrange garments around the same reference position | Differences in garment size remain visible |
| Individually filled thumbnails | Frame each garment separately | Each garment fills more of its image, but shared alignment is lost |
The script deliberately preserves framing. For example, a short vest will occupy less vertical space than a long apron. That is useful when relative size matters. Do not automatically crop every output if the images must later align.
Prepare one export object for each garment
Save your .blend file, then create a collection named Clothing. Put the garment mesh objects into it and give them descriptive object names. The example accepts meshes in nested collections too.
Use one mesh object per intended image. If a jacket’s buttons are separate objects, this script would export them separately when they belong to Clothing. In an export copy of the scene, combine the pieces that should appear together, or prepare a separate workflow that treats each garment collection as one export unit.
Before proceeding, check these prerequisites:
- The scene has an active camera and a working Cycles or EEVEE lighting setup.
- The
Clothingcollection and its parents are enabled for rendering and included in the active view layer. - Each garment is visible to the camera and fits inside its frame.
- Object render visibility has no animation or drivers that would override the script.
- The current frame contains the pose or simulated shape you want to export.
The loop controls hide_render, which Blender defines separately from viewport visibility. Selecting a garment or hiding its neighbors in the viewport does not establish the render isolation used here. Blender 4.5 object visibility definitions
Establish transparency and a useful camera view
Start with one manual preview. Set Render Properties → Film → Transparent, then choose PNG and RGBA in Output Properties. Transparent film makes the world background transparent; RGBA preserves an alpha channel in the saved image. These are separate settings, and the script sets both. Blender 4.5 render and image-format definitions
Frame the largest garment with some empty margin around its silhouette. Check sleeve tips, hems, and any projecting details. Keep the same resolution, camera, lighting, and color-management choices for all outputs.
For the fictional example, imagine a centered jacket with empty space around both sleeves, a shorter vest in the same position, and an apron extending farther down the canvas. The expected files retain those differences while showing transparent space around each item.
A floor or backdrop mesh is still scene geometry. This workflow hides that geometry during export. It also hides other garment meshes, so the resulting images show each item independently, without neighboring garments contributing occlusion or reflections.
Run a batch script that preserves names and restores settings
Open Blender’s Scripting workspace, create a text block, and paste the complete program below. It uses your prepared scene as input; it does not create sample clothing. Keep TEST_ONLY = True for the first run.
Each run creates a new output directory beside the saved .blend file. Filenames combine a sequence number with a cleaned object name, while manifest.csv records the original names. The numbered prefix prevents two names that clean to the same text from colliding.
The program uses a synchronous render call with write_still=True. Blender defines this option as writing the rendered still to the output path. Passing the active view layer’s name limits the request to that layer. Blender 4.5 render operator definitions
import bpy
import csv
import re
import tempfile
from pathlib import Path
COLLECTION = "Clothing"
TEST_ONLY = True # Change to False after checking the preview.
scene = bpy.context.scene
layer = bpy.context.view_layer
render = scene.render
image = render.image_settings
if not bpy.data.filepath:
raise RuntimeError("Save the .blend file before exporting.")
if scene.camera is None:
raise RuntimeError("Set an active scene camera.")
if render.engine not in {"CYCLES", "BLENDER_EEVEE_NEXT"}:
raise RuntimeError("Choose Cycles or EEVEE for this workflow.")
collection = bpy.data.collections.get(COLLECTION)
if collection is None:
raise RuntimeError(f"Create a collection named {COLLECTION!r}.")
targets = sorted(
(obj for obj in collection.all_objects if obj.type == "MESH"),
key=lambda obj: obj.name,
)
if not targets:
raise RuntimeError("The Clothing collection has no mesh objects.")
if any(obj.name not in layer.objects for obj in targets):
raise RuntimeError("Include every garment in the active view layer.")
if TEST_ONLY:
targets = targets[:1]
parent = Path(bpy.data.filepath).parent
out_dir = Path(tempfile.mkdtemp(prefix="clothing_export_", dir=parent))
print("Export directory:", out_dir)
objects = list(scene.objects)
visibility = [(obj, obj.hide_render) for obj in objects]
changes = {
"film_transparent": True,
"use_file_extension": True,
"use_compositing": False,
"use_sequencer": False,
"use_border": False,
"use_multiview": False,
"use_stamp": False,
}
old_render = {key: getattr(render, key) for key in changes}
old_filepath = render.filepath
old_image = {
key: getattr(image, key)
for key in ("file_format", "color_mode", "color_depth")
}
try:
for key, value in changes.items():
setattr(render, key, value)
image.file_format = "PNG"
image.color_mode = "RGBA"
image.color_depth = "8"
# Preserve camera, light, and armature visibility settings.
for obj in objects:
if obj.type not in {"CAMERA", "LIGHT", "ARMATURE"}:
obj.hide_render = True
with (out_dir / "manifest.csv").open(
"w", newline="", encoding="utf-8"
) as handle:
writer = csv.writer(handle)
writer.writerow(["object_name", "filename"])
for index, obj in enumerate(targets, 1):
stem = re.sub(r"[^A-Za-z0-9._-]+", "_", obj.name)
stem = stem.strip("._")[:80] or "garment"
filename = f"{index:03d}_{stem}.png"
path = out_dir / filename
render.filepath = str(path)
obj.hide_render = False
layer.update()
try:
result = bpy.ops.render.render(
write_still=True, layer=layer.name
)
if "FINISHED" not in result:
raise RuntimeError(f"Render interrupted: {obj.name}")
if not path.is_file() or path.stat().st_size == 0:
raise RuntimeError(f"Missing output: {filename}")
writer.writerow([obj.name, filename])
handle.flush()
print("Saved:", path)
finally:
obj.hide_render = True
finally:
for obj, hidden in visibility:
obj.hide_render = hidden
for key, value in old_render.items():
setattr(render, key, value)
render.filepath = old_filepath
for key, value in old_image.items():
setattr(image, key, value)
layer.update()
The script temporarily bypasses compositing and the video sequencer, disables render borders, and uses a single image view. That makes the batch a direct garment export. If your intended appearance depends on compositor effects, first decide which effects belong in every cutout before adapting this workflow. Blender exposes compositing and sequencer processing as separate render switches. Blender 4.5 render-processing definitions
The filename conversion was checked with spaces, punctuation, and duplicate cleaned names. The complete program has not been render-tested here because Blender is unavailable in this environment; the one-object preview is an essential local check.
Check the saved PNG before rendering everything
Open the actual exported PNG, not only Blender’s Render Result. Use an image viewer or editor that can display transparency, and inspect the garment over both a light and a dark background.
Check these visible results:
- Isolation: only the intended garment appears, including all its required pieces.
- Transparency: empty canvas areas reveal the background underneath.
- Framing: sleeves, hems, and details remain inside the image.
- Edges: thin straps and small openings look acceptable at the intended display size.
- Appearance: materials and the garment’s evaluated shape match your intended preview.
For an opaque fabric example, empty corners should be transparent and the central fabric should remain opaque. A viewer’s solid background color alone does not establish whether alpha was saved; placing the image over another background is a more useful practical check.
Once the preview passes, change TEST_ONLY to False and run again. The full batch goes into another new directory. With the three example objects, the expected filenames are 001_Canvas_Jacket.png, 002_Knit_Vest.png, and 003_Pocket_Apron.png, accompanied by the manifest.
Diagnose blank images, missing pieces, and changed shapes
| Symptom | Check first | Next action |
|---|---|---|
| Entire PNG is transparent | Camera framing, collection render settings, and view-layer inclusion | Manually render the same garment alone before retrying |
| Buttons or trim are missing | Whether those pieces are separate objects | Prepare one export mesh containing all intended pieces |
| Unwanted geometry appears | Instances or geometry generated by the target itself | Inspect the target’s evaluated render geometry |
| Garment shape changes | Dependencies on other scene objects | Compare its isolated render with the intended evaluated shape |
| Preview differs from the usual final render | Dependence on compositor effects or surrounding geometry | Decide which appearance should define the cutout |
| Only some garments exported | The first error and the output manifest | Fix that failure and rerun into a fresh directory |
Object visibility is only one level of scene control. Setting a garment’s hide_render to False does not repair every collection or view-layer restriction, nor does it assemble separate accessory objects. The script therefore requires those decisions during preparation.
For garments with simulation or modifier dependencies, test isolation before launching a long batch. If the intended shape depends on a complex setup, prepare an evaluated mesh copy at the chosen frame in a separate export scene. Keep the original editable setup available.
Finish with a complete, consistent export set
Count the PNGs and compare them with the number of garment meshes you intended to export. Use manifest.csv to associate each file with its original object name. The manifest records only outputs that completed and produced a nonempty file; it does not verify their visual content.
The script restores the settings and object visibility it changes when its normal cleanup runs, including after a rendering exception. Completed files remain available if a later render fails. It does not save those temporary scene changes into the .blend file.
Before using the set, review a contact sheet or open the images side by side. Every image should have the intended garment, transparent surroundings, matching canvas dimensions, and consistent framing. If the images are meant to align, stack two of them without moving either layer and confirm that their positions match your planned arrangement.