服装图库 · 批量:
CostumeGalleryBatch prepares multiple images from a local costume gallery as a consistent collection of clothing references, keeping each image paired with its original English keywords, Chinese description, category, and related information. It lets you organize selected costumes, standardize image sizes, and optionally mirror references for use in image-editing or reference-based creative workflows. This helps you compare outfits and preserve the connection between visual references and their descriptive text without processing each image individually. The node loads existing gallery assets rather than generating new clothing or automatically changing a subject’s outfit. It supports up to 32 distinct images per batch and limits the combined image area to 32 million pixels.
服装图库 · 批量 Input Parameters:
costume_ids
A required multiline STRING containing the IDs of the costumes you want to load from the selected gallery. You can separate IDs with line breaks, spaces, English or Chinese commas, or English or Chinese semicolons. Repeated IDs are removed automatically, keeping their first occurrence, so entering c1,c0 followed by another c1 selects only two distinct images. At least one valid ID is required, and the maximum is 32 distinct IDs. Every ID must exist in the selected asset source. The default is the project constant DEFAULT_ID; its literal value is not included in the provided code. You can select images in the gallery and send their IDs to this node rather than typing them manually.
order
A required COMBO that determines how the selected images and their matching information records are arranged. The options are 选择顺序 (selection order), 编号顺序 (ID order), and 分类顺序 (category order); the default is 选择顺序. Selection order follows the first appearance of each distinct ID in costume_ids. ID order sorts by the ID text, rather than extracting numbers for numerical sorting. Category order follows the category sequence defined by the selected catalogue, then sorts by ID within each category. Changing this setting changes the batch arrangement, but each information record remains aligned with its corresponding image.
asset_source
A required COMBO that selects the local asset library used to look up costume IDs, read image files, and retrieve descriptive information. Choose the library that contains your selected IDs: an ID available in one library is not necessarily available in another. The default is SOURCES[0], whose displayed value and complete option list are not shown in the supplied source. The surrounding code identifies builtin and custom as source keys, but does not establish the complete set of displayed dropdown labels. The selected source is also recorded in the information output as a normalized source key.
resize_mode
A required COMBO that controls how image dimensions are handled before the images are combined into a batch. The default is 等比留边. The modes identified in the supplied context are 原始尺寸 (original size), 等比留边 (proportional resizing with padding), 居中裁剪 (center crop), and 拉伸 (stretch). Original size preserves the source dimensions, but all selected images must already have matching dimensions. Proportional resizing with padding preserves the image’s proportions and adds borders to fit the target dimensions; the supplied tests verify white padding. Center crop fills the target frame by cropping around the center, which can remove clothing details near the edges. Stretch fits the target dimensions without preserving the original proportions, which can distort garment shapes. For modes other than original size, the target dimensions determine both the final image size and the batch pixel-limit calculation.
width
A required INT specifying the target image width in pixels when you use a resizing mode other than 原始尺寸. The default is 768. The minimum, maximum, and interface step are not shown because the shared input-definition function is not included in the supplied source. Increasing the width provides a wider image but increases the batch’s total pixel count and memory requirements. For resized images, the node checks that the number of distinct selected images multiplied by width and height does not exceed 32,000,000 pixels. In original-size mode, the loaded images retain their own widths instead.
height
A required INT specifying the target image height in pixels when you use a resizing mode other than 原始尺寸. The default is 1152. The minimum, maximum, and interface step are not available in the provided source. Increasing the height gives more vertical resolution, which can be useful for full-length outfit references, but also increases the total pixel count and memory requirements. Together with width, this setting defines the target frame used for padding, center cropping, or stretching. In original-size mode, the loaded images retain their own heights instead.
flip_horizontal
A required BOOLEAN that controls whether the selected images are mirrored left to right. Its values are False and True, with a default of False. Enabling it applies horizontal flipping to the images in the batch, which can help match the orientation of a reference to your composition. Mirroring also reverses visible text, logos, and asymmetric clothing details, so check whether those details matter for your work. This setting is recorded for each image in the information output, but the original descriptive keywords are not rewritten to account for the flip.
服装图库 · 批量 Output Parameters:
图片批次
An IMAGE containing all selected images stacked into one batch in the requested order. Its layout is batch size × height × width × color channels; the supplied tests demonstrate three-channel images with values between 0 and 1. For example, two images resized to a width of 64 and a height of 80 produce a shape of (2, 80, 64, 3). Every image must have the same dimensions for batching to succeed. You can connect this output to downstream nodes that accept image batches, although how those nodes handle individual images depends on their own behavior. The first image corresponds to information record index 0, the second to index 1, and so on.
信息清单JSON
A STRING containing a formatted JSON array with one record per image, in exactly the same order as the image batch. Each record includes index (the zero-based batch position), id (the costume ID), 分类 (category), 关键词 (original English keywords), 关键词中文 (original Chinese descriptive text), 标签 (the gallery’s stored tags), asset_source (the normalized source key), width and height (actual output dimensions), resize_mode, and flip_horizontal. Chinese characters remain readable rather than being converted into Unicode escape sequences. This output helps you track which costume and descriptions belong to each image; it is a structured text list, not a separate prompt output for each image, so downstream processing must read the JSON if you want to extract individual fields.
服装图库 · 批量 Usage Tips:
- Start with
等比留边when you need to preserve an entire outfit without changing its proportions. It is especially useful when the selected references have different aspect ratios. - Use
居中裁剪when filling the whole frame matters more than preserving the edges, and preview the result to check that hats, sleeves, shoes, or long hems have not been cropped away. - Keep the default 768 × 1152 size for a portrait-shaped batch when appropriate for your references. At this size, 32 images total 28,311,552 pixels, which is within the 32-million-pixel limit.
- Reduce image dimensions or split your selection into smaller batches when working at higher resolutions. At 1024 × 1024, at most 30 images fit within the pixel limit, even though the separate image-count limit is 32. - Use
原始尺寸only when all selected images already share the same dimensions. Changingwidthorheightwill not resolve mismatched source sizes in this mode; switch to a resizing mode instead. - Choose
选择顺序to maintain a manually arranged sequence,编号顺序for a consistent ID-based arrangement, or分类顺序to group images according to the catalogue’s category ordering. - Keep
信息清单JSONalongside the batch when tracking references. Match each image to its record using the zero-basedindex, and extract关键词or关键词中文with a JSON-capable downstream tool if you need descriptive text separately. - Leave
flip_horizontaldisabled for references containing lettering or important left-right garment details unless you intentionally want to mirror them.
服装图库 · 批量 Common Errors and Solutions:
请先在图库中选择至少一张图片。
- Explanation: The ID list contains no usable entries. Empty text, whitespace, or separators alone do not select an image.
- Solution: Select at least one image in the gallery and send its ID to the node, or enter a valid ID manually.
服装 ID 清单须为文本。
- Explanation: The ID parser received a value that is not text. This can occur when calling the node programmatically with an incompatible value.
- Solution: Supply one text string containing the IDs, separated by supported spaces, line breaks, commas, or semicolons, rather than supplying a list or another data type.
单批最多 32 张,请减少所选图片。
- Explanation: The ID list contains more than 32 distinct entries after duplicates have been removed.
- Solution: Reduce the selection to 32 distinct IDs or fewer, or divide it into multiple batches.
素材库中找不到服装 ID「…」。请重新选图或检查所选素材库。
- Explanation: A requested ID does not exist in the currently selected catalogue. The message identifies the missing ID.
- Solution: Check the ID for typing errors, confirm that
asset_sourcepoints to the correct library, and reselect the image from that library if necessary.
未知图片排列方式。
- Explanation: The supplied ordering value is not one of the three supported options.
- Solution: Choose
选择顺序,编号顺序, or分类顺序. If you call the node through code, pass the exact option text.
原始图片尺寸不一致,请改用等比留边、居中裁剪或拉伸来统一尺寸。
- Explanation: The loaded images do not all have the same shape, so they cannot be combined into a single image batch. This is particularly relevant when using original-size mode.
- Solution: Select
等比留边,居中裁剪, or拉伸and set a shared width and height. Alternatively, keep original-size mode and select only images with matching dimensions.
单批图片总像素超过3200万,请减少图片数量或输出尺寸。
- Explanation: The combined image area exceeds 32,000,000 pixels. For resized batches, this is calculated from the number of images multiplied by the target width and height; original-size batches are checked using their actual image dimensions.
- Solution: Select fewer images, reduce the target dimensions, or split the selection into smaller batches. If you are using original-size mode, switch to a resizing mode to make the images smaller.
图片无法读取或已损坏:…
- Explanation: During the original-size image check, an image could not be opened, had invalid image data, or triggered the image library’s protection against excessively large images. The message includes the affected costume ID.
- Solution: Locate that image in the selected library and verify that it opens correctly. Restore or replace damaged files; if the image is exceptionally large, create a smaller valid version and update the gallery asset as needed.
无法读取 data/costume-zh.json,请检查素材目录结构和 JSON 格式。
- Explanation: The catalogue data could not be read or parsed. The file may be missing, inaccessible, or incorrectly formatted.
- Solution: Confirm that the selected library contains
data/costume-zh.jsonin the expected location, restore it from a working copy if necessary, and validate its JSON syntax if you edited it.
data/costume-zh.json 须为非空的图片记录数组。
- Explanation: The catalogue was read, but its top-level content is not a nonempty array of image records.
- Solution: Restore a valid catalogue or correct the file so it contains a JSON array with at least one properly structured costume record.
第 … 条素材须为对象。
- Explanation: One entry in the catalogue is not a JSON object containing the fields for an image record. The message identifies its position.
- Solution: Check the indicated entry and replace it with a correctly structured record. The supplied validation requires nonempty text fields including
id,分类,关键词,关键词中文, and原图.
无法读取 data/meta-zh.json 中的同义词。
- Explanation: The catalogue’s synonym metadata could not be read or has an invalid structure. The provided code expects synonym mappings whose values are arrays of text.
- Solution: Check
data/meta-zh.jsonin the selected asset library, restore a valid copy, or correct its JSON and synonym structure if you maintain a custom library.
