Prompt Templates for Documents and Publishing in GPT-Image2
The freestylefly/awesome-gpt-image-2 repository provides structured prompt templates for the Documents & Publishing category in docs/templates.md, enabling generation of white papers, manuals, and encyclopedic plates through both plain-text and JSON schema interfaces.
GPT-Image2 organizes its generation capabilities into thematic categories defined in data/cases.json and documented in docs/templates.md. The Documents & Publishing section—referenced in the repository's main README.md—contains industrial-strength prompt skeletons designed for professional publishing workflows. These templates enforce strict layout constraints, typographic rules, and output specifications to ensure generated images meet print-ready standards.
Document Template Structure in GPT-Image2
The document templates in docs/templates.md follow a predictable anatomy that separates content structure from visual styling. This separation allows the generation engine in api/generate-image.js to parse instructions unambiguously.
Purpose and Document Types
Each template specifies a document type (文书类型) that dictates the overall architecture. According to the source catalogue, supported variants include:
- 白皮书 (White Paper): Formal research documents with executive summaries
- 使用手册 (User Manual): Step-by-step instructional layouts with numbered procedures
- 百科图表 (Encyclopedic Plate): Visual reference sheets with labeled diagrams
The case_name field in data/cases.json maps these types to specific template IDs (e.g., case-document-whitepaper, case-document-manual).
Core Layout Components
Every document template requires explicit section definitions using hierarchical placeholders:
标题:[主标题]
副标题:[副标题]
章节:
1. [章节1标题]——[内容摘要]
2. [章节2标题]——[内容摘要]
3. [章节3标题]——[内容摘要]
In docs/templates.md, the 章节 (chapter) component enforces ordered lists to maintain logical flow. The generation endpoint api/generate-image.js validates that section counts match the requested document type—white papers expect 4-6 sections, while manuals require 3+ hierarchical levels.
Visual Style and Constraints
Templates specify 禁用项 (avoid-list) and 约束 (constraints) to prevent common generation errors:
- 页面尺寸 (Page size): A4 (210×297mm) or A3 (297×420mm)
- 留白 (Margins): Minimum 30% white-space ratio for academic readability
- 分辨率 (Resolution): 300 dpi minimum for PDF output
- 禁用元素 (Forbidden elements): Headers, footers, decorative borders, and non-essential icons must be explicitly excluded via
"constraints": ["No header/footer", "No decorative icons"]in the JSON payload.
Text-Based Prompt Templates
For direct use in the web interface at gpt-image2.canghe.ai, docs/templates.md provides markdown-formatted prompt templates. These plaintext versions rely on bracketed placeholders that users replace before submission.
生成一份[文档类型],主题为[主题],包含以下结构:
标题:【标题】
副标题:【副标题】
章节:
1. 【章节1标题】——【简短说明】
2. 【章节2标题】——【简短说明】
3. 【章节3标题】——【简短说明】
风格:学术/商务,主色[十六进制颜色],辅助色[十六进制颜色],字体[字体名称]。
页面尺寸:A4,留白≥30%。
输出:300 dpi PDF,文字清晰可读,可编辑层级保留。
禁用项:不要生成页眉、页脚、Logo、装饰性边框。
The 风格 (style) parameter accepts three primary values defined in the template library: 简约 (Minimalist), 学术 (Academic), and 商务 (Business). Color values must use hexadecimal notation (e.g., #1A73E8) to ensure consistent rendering across the generation pipeline.
JSON Schema for Automated Agents
For programmatic access via api/generate-image.js, the repository provides a machine-readable schema documented in agents/skills/gpt-image-2-style-library/SKILL.md. This JSON structure mirrors the text template but enables agent-based workflows.
{
"type": "Document",
"case_name": "document_white_paper",
"document_type": "White Paper",
"topic": "AI-Driven Climate Modeling",
"title": "Neural Approaches to Carbon Capture",
"subtitle": "A Technical Survey",
"sections": [
{"heading": "Executive Summary", "summary": " Overview of neural network applications..."},
{"heading": "Methodology", "summary": "Transformer-based forecasting..."},
{"heading": "Results", "summary": "Accuracy improvements of 23%..."},
{"heading": "Conclusion", "summary": "Future research directions..."}
],
"style": {
"theme": "Academic",
"primary_color": "#2C3E50",
"secondary_color": "#ECF0F1",
"font": "Source Han Serif CN"
},
"layout": {
"page_size": "A4",
"margin_ratio": 0.3,
"orientation": "portrait"
},
"output": {
"format": "PDF",
"dpi": 300,
"color_space": "CMYK"
},
"constraints": [
"No header/footer",
"No page numbers",
"No decorative icons"
]
}
When posted to api/generate-image.js, this payload triggers validation against the schema in data/cases.json before forwarding to the image generation backend. The "case_name": "document_white_paper" key ensures the system loads the appropriate layout templates from docs/templates.md rather than defaulting to UI or poster modes.
Implementation Examples
The following examples demonstrate production-ready implementations using both manual prompting and agent automation.
Generating a Technical Manual
This example targets the case-document-manual template with specific installation instructions:
生成一份使用手册,主题为"GPT-Image2 Enterprise Deployment",包含以下结构:
标题:GPT-Image2 企业部署指南
副标题:Linux Server Edition v2.4
章节:
1. 系统要求——Ubuntu 22.04 LTS, 32GB RAM, NVIDIA A100
2. 依赖安装——Docker, CUDA 12.1, NVIDIA Container Toolkit
3. 服务配置——api/generate-image.js 环境变量设置
4. 验证测试——运行诊断脚本 /scripts/verify.sh
风格:商务,主色#0044CC,辅助色#E8F0FE,字体Inter。
页面尺寸:A4,留白25%,双栏布局。
输出:300 dpi PNG,文字抗锯齿。
禁用项:不要生成页眉页脚,避免阴影装饰。
Creating an Encyclopedia Plate
For educational content using the encyclopedia template:
{
"type": "Document",
"case_name": "document_encyclopedia",
"document_type": "Encyclopedic Plate",
"topic": "Deep Ocean Ecosystems",
"title": "Hadal Zone Biology",
"subtitle": "Species of the Mariana Trench",
"sections": [
{"heading": "Amphipods", "summary": "Giant scavenging crustaceans..."},
{"heading": "Xenophyophores", "summary": "Giant single-celled organisms..."},
{"heading": "Holothurians", "summary": "Sea cucumbers adapted to high pressure..."}
],
"style": {
"theme": "Educational",
"primary_color": "#1E3A8A",
"secondary_color": "#93C5FD",
"font": "Noto Sans SC"
},
"layout": {
"page_size": "A3",
"margin_ratio": 0.2,
"columns": 2
},
"output": {
"format": "PDF",
"dpi": 300
},
"constraints": [
"No decorative borders",
"All labels must use Arabic numerals",
"Background must be white"
]
}
API Integration Workflow
To generate documents programmatically, post the JSON payload to the local endpoint:
// File: scripts/generate-document.js
const fs = require('fs');
const path = require('path');
const promptPayload = {
type: "Document",
case_name: "document_white_paper",
// ... full payload as defined above
};
fetch('http://localhost:3000/api/generate-image.js', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(promptPayload)
})
.then(res => res.blob())
.then(blob => {
fs.writeFileSync('output.pdf', Buffer.from(blob));
});
The api/generate-image.js handler validates the "type": "Document" field against the schema registry in data/cases.json before queuing the job.
Key Source Files and Architecture
Understanding the template system requires familiarity with these specific repository paths:
-
docs/templates.md– Master catalogue containing plaintext templates for all document sub-types (white paper, manual, encyclopedia), including Chinese localization tags like 章节 and 禁用项. -
data/cases.json– Metadata registry mappingcase_namevalues (e.g.,document_white_paper) to layout algorithms and validation rules. Agents reference this file to determine available template parameters. -
api/generate-image.js– Express.js endpoint handling POST requests. It parses the JSON schema, validates constraints against minimum margin ratios (≥0.3 for academic documents), and forwards compliant requests to the generation backend. -
agents/skills/gpt-image-2-style-library/SKILL.md– Documentation for autonomous agents importing these templates. Defines the TypeScript interfaces forDocumentTemplateandLayoutConstraint. -
README.md– Entry point linking to the Documents & Publishing gallery section, providing category overview and constraints documentation.
Summary
- The Documents & Publishing category in
docs/templates.mdprovides specialized templates for white papers, manuals, and encyclopedic plates with strict layout controls. - Templates enforce minimum 30% margin ratios, 300 dpi resolution, and explicit 禁用项 (avoid-lists) to eliminate decorative artifacts.
- Two input formats are supported: plaintext with bracketed placeholders for manual UI entry, and JSON schemas for programmatic access via
api/generate-image.js. - The
case_namefield indata/cases.jsonroutes requests to appropriate layout engines, ensuring academic, business, or educational styling is applied consistently. - Agent implementations should reference
agents/skills/gpt-image-2-style-library/SKILL.mdfor schema definitions and validation rules.
Frequently Asked Questions
How do I prevent GPT-Image2 from adding headers and footers to my document?
Include the constraint "No header/footer" in the 禁用项 array of your JSON payload, or add the line 禁用项:不要生成页眉、页脚 to your plaintext prompt. The validation layer in api/generate-image.js specifically checks for these flags before generation begins.
What is the difference between the "Academic" and "Business" style themes?
The 学术 (Academic) style enforces serif fonts (e.g., Source Han Serif), single-column layouts, and minimum 30% margins for readability. The 商务 (Business) style permits sans-serif fonts, tighter margins (25%), and supports multi-column layouts. These definitions are hardcoded in data/cases.json under the respective case_name configurations.
Can I generate multi-page documents with these templates?
Currently, the templates in docs/templates.md generate single-page layouts optimized for A4 or A3 sheets. For multi-page outputs, you must submit separate API calls to api/generate-image.js for each page, using the sections array to distribute content across requests, then concatenate the resulting PDFs using external tools.
Which file contains the complete list of available document templates?
The comprehensive catalogue resides in docs/templates.md, which defines all document sub-categories including white papers (白皮书), manuals (使用手册), and encyclopedia plates (百科图表). Category metadata and validation rules are stored in data/cases.json, while usage examples for agents appear in agents/skills/gpt-image-2-style-library/SKILL.md.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →