# Batch Generation Strategy for Creating Multi-Card Series: A Complete Guide to the Twelve Gold Saints Implementation

> Discover the batch generation strategy for multi-card series like the Twelve Gold Saints. Learn how to create card collections with a single request in this complete guide.

- Repository: [苍何/awesome-gpt-image-2](https://github.com/freestylefly/awesome-gpt-image-2)
- Tags: how-to-guide
- Published: 2026-09-02

---

**The freestylefly/awesome-gpt-image-2 repository generates multi-card collections like the Twelve Gold Saints by issuing a single image-generation request containing a grid-formatted prompt, returning one composite image with all cards arranged in a 12-grid layout rather than making separate API calls per card.**

Creating consistent multi-card series for generative AI galleries requires efficient batch processing techniques. The batch generation strategy for creating multi-card series documented in `freestylefly/awesome-gpt-image-2` leverages single-request grid generation to produce entire card collections in one API call. This approach minimizes compute costs while ensuring visual uniformity across all cards in the series.

## How the Single-Request Grid Strategy Works

Instead of generating individual cards through separate API calls, the repository sends one comprehensive prompt specifying the entire grid layout. For the Twelve Gold Saints series, the prompt explicitly requests a 12-grid arrangement with 4 cards per row at a 16:9 aspect ratio, with Chinese names labeled on each card.

The image generation API interprets this layout specification as a single composite image task rather than multiple discrete operations. According to the source code in [`docs/gallery-part-2.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/docs/gallery-part-2.md), the prompt structure includes precise grid directives that guide the model to organize multiple character cards within one canvas.

## Implementation in [`api/generate-image.js`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/api/generate-image.js)

The core generation logic resides in [`api/generate-image.js`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/api/generate-image.js), where the `generateImage` function handles the batch creation process. This function forwards the complete grid prompt to the image generation service and returns the composite image URL.

```javascript
// Example: generate a 12-grid card set in one call
import { generateImage } from "./api/generate-image.js";

const prompt = `
[English]
Generate a 12-grid card image of the 12 Gold Saints from Saint Seiya,
with the corresponding Chinese name written on each card,
4 per row, aspect ratio 16:9.
`;

const result = await generateImage(prompt);
// `result` is a single image containing all 12 cards.

```

Internally, the function utilizes the OpenAI images API to process the grid request:

```javascript
// Internals (simplified) – generate-image.js
export async function generateImage(prompt) {
  // Sends the full prompt to the image generation service
  const response = await openai.images.generate({ prompt, n: 1, size: "1024x576" });
  return response.data[0].url;
}

```

## Crafting Grid Prompts for Multi-Card Series

Successful batch generation depends on precise prompt engineering that specifies layout constraints. The Twelve Gold Saints implementation demonstrates that including explicit grid dimensions (12-grid, 4 per row), aspect ratio requirements (16:9), and labeling instructions ensures the model renders the composite correctly.

This approach eliminates the need for post-processing image stitching or separate generation loops. The workflow streamlines directly into `scripts/generate-site-data.mjs`, which consumes these pre-composed grid images for site rendering without additional transformation steps.

## Gallery Integration and Asset Pipeline

Once generated, these composite images flow into the documentation pipeline. The [`docs/gallery-part-2.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/docs/gallery-part-2.md) file catalogs the specific prompts used for series like the Twelve Gold Saints, serving as both documentation and reference for the grid formatting syntax.

The `scripts/generate-site-data.mjs` script processes these generated assets to populate the gallery interface, treating each composite grid image as a single asset that contains the entire card series.

## Summary

- The batch generation strategy for creating multi-card series uses **single-request grid generation** rather than multiple API calls to minimize costs.
- The `generateImage` function in [`api/generate-image.js`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/api/generate-image.js) processes prompts requesting specific grid layouts such as 12-grid, 4 per row, with 16:9 aspect ratio.
- Composite images are generated at resolution **1024x576** through the OpenAI images API as implemented in the source handler.
- The Twelve Gold Saints implementation demonstrates Chinese character labeling on each card within a unified grid layout.
- Generated composites are cataloged in [`docs/gallery-part-2.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/docs/gallery-part-2.md) and processed by `scripts/generate-site-data.mjs` for direct site integration.

## Frequently Asked Questions

### How does the batch generation strategy reduce API costs compared to individual card generation?

By sending one prompt that generates all twelve cards in a single 1024x576 image, the repository makes only one API call per complete series. Generating cards individually would require twelve separate requests to `generateImage` and the underlying `openai.images.generate` method, multiplying token and compute costs while increasing total generation time.

### Can the grid layout be customized for different card counts?

Yes, the prompt structure supports variable grid configurations. While the Twelve Gold Saints uses a 12-grid with 4 cards per row, the prompt syntax documented in [`docs/gallery-part-2.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/docs/gallery-part-2.md) demonstrates that you can specify any row count and aspect ratio, allowing the `generateImage` function to create collections ranging from 4-card sets to 16-card grids within single API responses.

### What determines the resolution of the generated multi-card image?

The resolution is specified in the `generateImage` function within [`api/generate-image.js`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/api/generate-image.js), which passes `size: "1024x576"` to the OpenAI API. This 16:9 aspect ratio accommodates the 4-per-row grid layout specified in the Twelve Gold Saints prompt, ensuring each card maintains readable proportions when displayed in the gallery interface generated by `scripts/generate-site-data.mjs`.

### Are the individual cards extractable from the composite image?

The repository treats the composite as a single atomic asset. While the grid image contains all twelve cards visually separated, the current implementation in `scripts/generate-site-data.mjs` utilizes the full composite image for gallery display rather than programmatically cropping individual cards from the generated grid.