mcp-image 0.5.6 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -3
- package/bin/install-skills.js +114 -0
- package/dist/api/geminiTextClient.d.ts +4 -0
- package/dist/api/geminiTextClient.d.ts.map +1 -1
- package/dist/api/geminiTextClient.js +11 -4
- package/dist/api/geminiTextClient.js.map +1 -1
- package/dist/bin/install-skills.d.ts +14 -0
- package/dist/bin/install-skills.d.ts.map +1 -0
- package/dist/bin/install-skills.js +108 -0
- package/dist/bin/install-skills.js.map +1 -0
- package/dist/business/structuredPromptGenerator.js +3 -3
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -36
- package/dist/index.js.map +1 -1
- package/dist/server-main.d.ts +5 -0
- package/dist/server-main.d.ts.map +1 -0
- package/dist/server-main.js +39 -0
- package/dist/server-main.js.map +1 -0
- package/package.json +8 -4
- package/skills/image-generation/SKILL.md +131 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ A powerful MCP (Model Context Protocol) server that enables AI assistants to gen
|
|
|
7
7
|
## ✨ Features
|
|
8
8
|
|
|
9
9
|
- **AI-Powered Image Generation**: Create images from text prompts using Gemini 3 Pro Image (Nano Banana Pro)
|
|
10
|
-
- **Intelligent Prompt Enhancement**: Automatically optimizes your prompts using Gemini 2.
|
|
10
|
+
- **Intelligent Prompt Enhancement**: Automatically optimizes your prompts using Gemini 2.5 Flash for superior image quality
|
|
11
11
|
- Adds photographic and artistic details
|
|
12
12
|
- Enriches lighting, composition, and atmosphere descriptions
|
|
13
13
|
- Preserves your intent while maximizing generation quality
|
|
@@ -26,6 +26,53 @@ A powerful MCP (Model Context Protocol) server that enables AI assistants to gen
|
|
|
26
26
|
- **Multiple Output Formats**: PNG, JPEG, WebP support
|
|
27
27
|
- **File Output**: Images are saved as files for easy access and integration
|
|
28
28
|
|
|
29
|
+
## 🎨 Agent Skill: Image Generation Prompt Guide
|
|
30
|
+
|
|
31
|
+
This project also provides a standalone **Agent Skill** that teaches AI assistants to write better image generation prompts — no MCP server or API key required.
|
|
32
|
+
|
|
33
|
+
### What it does
|
|
34
|
+
|
|
35
|
+
> **Note:** This skill does not generate images itself — it teaches your AI assistant to write better prompts. Your AI tool must already have built-in image generation capabilities (e.g., Cursor's image generation feature).
|
|
36
|
+
|
|
37
|
+
A reference guide that AI assistants use to improve image generation prompts based on the **Subject-Context-Style** framework. Works with any image model (Gemini, DALL-E, Flux, Stable Diffusion, etc.).
|
|
38
|
+
|
|
39
|
+
Covers:
|
|
40
|
+
|
|
41
|
+
- **Prompt structure** — How to build prompts around Subject, Context, and Style
|
|
42
|
+
- **Visual details** — Lighting, textures, camera angles, atmosphere, text in images
|
|
43
|
+
- **Advanced features** — Character consistency, multi-element composition, factual accuracy, purpose-specific output
|
|
44
|
+
- **Image editing** — How to describe edits while keeping the original look intact
|
|
45
|
+
|
|
46
|
+
### Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx mcp-image skills install --path <target-directory>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The skill will be placed at `<path>/image-generation/SKILL.md`. Specify the skills directory for your AI tool:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Cursor
|
|
56
|
+
npx mcp-image skills install --path ~/.cursor/skills
|
|
57
|
+
|
|
58
|
+
# Codex
|
|
59
|
+
npx mcp-image skills install --path ~/.codex/skills
|
|
60
|
+
|
|
61
|
+
# Claude Code
|
|
62
|
+
npx mcp-image skills install --path ~/.claude/skills
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### When to use the Skill vs the MCP server
|
|
66
|
+
|
|
67
|
+
| | MCP Server | Agent Skill |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| **Use when** | Your AI tool does not have built-in image generation | Your AI tool already generates images natively |
|
|
70
|
+
| **Requires** | Gemini API key | Nothing |
|
|
71
|
+
| **What it does** | Generates images via API | Teaches the AI to write better prompts |
|
|
72
|
+
| **Works with** | MCP-compatible tools | Any tool supporting the [Agent Skills](https://agentskills.io) standard |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
29
76
|
## 🔧 Prerequisites
|
|
30
77
|
|
|
31
78
|
- **Node.js** 20 or higher
|
|
@@ -162,7 +209,7 @@ The system automatically enhances this to include rich details about lighting, m
|
|
|
162
209
|
### `generate_image` Tool
|
|
163
210
|
|
|
164
211
|
The MCP server exposes a single tool for all image operations. Internally, it uses a two-stage process:
|
|
165
|
-
1. **Prompt Optimization**: Gemini 2.
|
|
212
|
+
1. **Prompt Optimization**: Gemini 2.5 Flash analyzes and enriches your prompt
|
|
166
213
|
2. **Image Generation**: Gemini 3 Pro Image creates the final image
|
|
167
214
|
|
|
168
215
|
#### Parameters
|
|
@@ -229,7 +276,7 @@ The MCP server exposes a single tool for all image operations. Internally, it us
|
|
|
229
276
|
## 💰 Usage Notes
|
|
230
277
|
|
|
231
278
|
- This MCP server uses the paid Gemini API for both prompt optimization and image generation
|
|
232
|
-
- Gemini 2.
|
|
279
|
+
- Gemini 2.5 Flash for intelligent prompt enhancement (minimal token usage)
|
|
233
280
|
- Gemini 3 Pro Image for actual image generation
|
|
234
281
|
- Check current pricing and rate limits at [Google AI Studio](https://aistudio.google.com/)
|
|
235
282
|
- Monitor your API usage to avoid unexpected charges
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict'
|
|
3
|
+
|
|
4
|
+
const { cpSync, existsSync, mkdirSync } = require('node:fs')
|
|
5
|
+
const { dirname, resolve } = require('node:path')
|
|
6
|
+
|
|
7
|
+
const SKILLS_SOURCE = resolve(__dirname, '..', 'skills', 'image-generation')
|
|
8
|
+
const SKILL_DIR_NAME = 'image-generation'
|
|
9
|
+
|
|
10
|
+
function printHelp() {
|
|
11
|
+
console.log(`
|
|
12
|
+
Image Generation Skills Installer
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
npx mcp-image skills install --path <path>
|
|
16
|
+
|
|
17
|
+
Options:
|
|
18
|
+
--path <path> Install skills to the specified directory.
|
|
19
|
+
The skill will be placed at <path>/${SKILL_DIR_NAME}/
|
|
20
|
+
|
|
21
|
+
--help, -h Show this help message
|
|
22
|
+
|
|
23
|
+
Examples:
|
|
24
|
+
npx mcp-image skills install --path ~/.claude/skills
|
|
25
|
+
npx mcp-image skills install --path ./.claude/skills
|
|
26
|
+
npx mcp-image skills install --path /custom/path
|
|
27
|
+
`)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function parseArgs(args) {
|
|
31
|
+
const options = { path: undefined, help: false }
|
|
32
|
+
|
|
33
|
+
for (let i = 0; i < args.length; i++) {
|
|
34
|
+
const arg = args[i]
|
|
35
|
+
|
|
36
|
+
switch (arg) {
|
|
37
|
+
case '--help':
|
|
38
|
+
case '-h':
|
|
39
|
+
options.help = true
|
|
40
|
+
break
|
|
41
|
+
|
|
42
|
+
case '--path': {
|
|
43
|
+
const pathArg = args[i + 1]
|
|
44
|
+
if (!pathArg) {
|
|
45
|
+
console.error('Error: --path requires a path argument')
|
|
46
|
+
process.exit(1)
|
|
47
|
+
}
|
|
48
|
+
options.path = pathArg
|
|
49
|
+
i++
|
|
50
|
+
break
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
default:
|
|
54
|
+
if (arg && arg.startsWith('-')) {
|
|
55
|
+
console.error(`Unknown option: ${arg}`)
|
|
56
|
+
process.exit(1)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return options
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function install(targetPath) {
|
|
65
|
+
if (!existsSync(SKILLS_SOURCE)) {
|
|
66
|
+
console.error(`Error: Skills source not found at ${SKILLS_SOURCE}`)
|
|
67
|
+
process.exit(1)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const targetDir = dirname(targetPath)
|
|
71
|
+
if (!existsSync(targetDir)) {
|
|
72
|
+
mkdirSync(targetDir, { recursive: true })
|
|
73
|
+
console.log(`Created directory: ${targetDir}`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
cpSync(SKILLS_SOURCE, targetPath, { recursive: true })
|
|
77
|
+
console.log(`Installed skills to: ${targetPath}`)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function run(args) {
|
|
81
|
+
if (args.length === 0) {
|
|
82
|
+
printHelp()
|
|
83
|
+
process.exit(0)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const options = parseArgs(args)
|
|
87
|
+
|
|
88
|
+
if (options.help) {
|
|
89
|
+
printHelp()
|
|
90
|
+
process.exit(0)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (!options.path) {
|
|
94
|
+
console.error('Error: --path is required')
|
|
95
|
+
console.error('Run "npx mcp-image skills install --help" for usage information.')
|
|
96
|
+
process.exit(1)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const targetPath = resolve(options.path, SKILL_DIR_NAME)
|
|
100
|
+
|
|
101
|
+
console.log('Installing image-generation skills...')
|
|
102
|
+
console.log(`Path: ${targetPath}`)
|
|
103
|
+
console.log()
|
|
104
|
+
|
|
105
|
+
install(targetPath)
|
|
106
|
+
|
|
107
|
+
console.log()
|
|
108
|
+
console.log('Installation complete!')
|
|
109
|
+
console.log()
|
|
110
|
+
console.log('Installed files:')
|
|
111
|
+
console.log(' - image-generation/SKILL.md')
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
module.exports = { run }
|
|
@@ -15,6 +15,10 @@ export interface GenerationConfig {
|
|
|
15
15
|
timeout?: number;
|
|
16
16
|
systemInstruction?: string;
|
|
17
17
|
inputImage?: string;
|
|
18
|
+
topP?: number;
|
|
19
|
+
topK?: number;
|
|
20
|
+
frequencyPenalty?: number;
|
|
21
|
+
presencePenalty?: number;
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
24
|
* Interface for Gemini Text Client - pure API client
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geminiTextClient.d.ts","sourceRoot":"","sources":["../../src/api/geminiTextClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"geminiTextClient.d.ts","sourceRoot":"","sources":["../../src/api/geminiTextClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,YAAY,CACV,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,YAAY,CAAC,CAAC,CAAA;IAEzD;;;OAGG;IACH,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,GAAG,YAAY,CAAC,CAAC,CAAA;CAC9E;AAiSD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAY/F"}
|
|
@@ -22,7 +22,7 @@ const DEFAULT_GENERATION_CONFIG = {
|
|
|
22
22
|
*/
|
|
23
23
|
class GeminiTextClientImpl {
|
|
24
24
|
constructor(config) {
|
|
25
|
-
this.modelName = 'gemini-2.
|
|
25
|
+
this.modelName = 'gemini-2.5-flash';
|
|
26
26
|
this.genai = new genai_1.GoogleGenAI({
|
|
27
27
|
apiKey: config.geminiApiKey,
|
|
28
28
|
});
|
|
@@ -80,14 +80,21 @@ class GeminiTextClientImpl {
|
|
|
80
80
|
// Text-only request
|
|
81
81
|
contents = prompt;
|
|
82
82
|
}
|
|
83
|
-
// Use the updated API structure for @google/genai v1.
|
|
83
|
+
// Use the updated API structure for @google/genai v1.42.0+
|
|
84
84
|
const apiCall = this.genai.models.generateContent({
|
|
85
85
|
model: this.modelName,
|
|
86
86
|
contents,
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
config: {
|
|
88
|
+
...(config.systemInstruction !== undefined && {
|
|
89
|
+
systemInstruction: config.systemInstruction,
|
|
90
|
+
}),
|
|
89
91
|
temperature: config.temperature || 0.7,
|
|
90
92
|
maxOutputTokens: config.maxTokens || 8192,
|
|
93
|
+
topP: config.topP ?? 0.95,
|
|
94
|
+
topK: config.topK ?? 40,
|
|
95
|
+
thinkingConfig: {
|
|
96
|
+
thinkingBudget: 0,
|
|
97
|
+
},
|
|
91
98
|
},
|
|
92
99
|
});
|
|
93
100
|
const response = await Promise.race([apiCall, timeoutPromise]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geminiTextClient.js","sourceRoot":"","sources":["../../src/api/geminiTextClient.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;
|
|
1
|
+
{"version":3,"file":"geminiTextClient.js","sourceRoot":"","sources":["../../src/api/geminiTextClient.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAiVH,wDAYC;AA3VD,yCAA2C;AAE3C,4CAAyC;AAEzC,4CAA8D;AAuC9D;;GAEG;AACH,MAAM,yBAAyB,GAAG;IAChC,WAAW,EAAE,GAAG;IAChB,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,KAAK;CACN,CAAA;AAyCV;;GAEG;AACH,MAAM,oBAAoB;IAIxB,YAAY,MAAc;QAHT,cAAS,GAAG,kBAAkB,CAAA;QAI7C,IAAI,CAAC,KAAK,GAAG,IAAI,mBAAW,CAAC;YAC3B,MAAM,EAAE,MAAM,CAAC,YAAY;SAC5B,CAAgC,CAAA;IACnC,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,MAAc,EACd,SAA2B,EAAE;QAE7B,mCAAmC;QACnC,MAAM,YAAY,GAAG;YACnB,GAAG,yBAAyB;YAC5B,GAAG,MAAM;SACV,CAAA;QAED,iBAAiB;QACjB,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAA;QACzD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC9B,OAAO,gBAAgB,CAAA;QACzB,CAAC;QAED,IAAI,CAAC;YACH,kBAAkB;YAClB,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;YACpE,OAAO,IAAA,WAAE,EAAC,aAAa,CAAC,CAAA;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CA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G;IACK,mBAAmB,CAAC,MAAc;QACxC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1C,OAAO,IAAA,YAAG,EACR,IAAI,uBAAc,CAChB,uBAAuB,EACvB,kDAAkD,CACnD,CACF,CAAA;QACH,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;YAC3B,OAAO,IAAA,YAAG,EACR,IAAI,uBAAc,CAChB,iBAAiB,EACjB,4DAA4D,CAC7D,CACF,CAAA;QACH,CAAC;QAED,OAAO,IAAA,WAAE,EAAC,IAAI,CAAC,CAAA;IACjB,CAAC;CACF;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,MAAc;IACnD,IAAI,CAAC;QACH,OAAO,IAAA,WAAE,EAAC,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAA;IAC7C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAA;QAC7E,OAAO,IAAA,YAAG,EACR,IAAI,uBAAc,CAChB,4CAA4C,YAAY,EAAE,EAC1D,yFAAyF,CAC1F,CACF,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Generation Skills Installer
|
|
3
|
+
*
|
|
4
|
+
* Installs image-generation skills to the specified path.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* npx mcp-image skills install --path <path>
|
|
8
|
+
* npx mcp-image skills install --path ~/.claude/skills
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Run the skills installer with the given arguments
|
|
12
|
+
*/
|
|
13
|
+
export declare function run(args: string[]): void;
|
|
14
|
+
//# sourceMappingURL=install-skills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-skills.d.ts","sourceRoot":"","sources":["../../src/bin/install-skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsFH;;GAEG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAiCxC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Image Generation Skills Installer
|
|
4
|
+
*
|
|
5
|
+
* Installs image-generation skills to the specified path.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx mcp-image skills install --path <path>
|
|
9
|
+
* npx mcp-image skills install --path ~/.claude/skills
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.run = run;
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
14
|
+
const node_path_1 = require("node:path");
|
|
15
|
+
// Skills source directory (relative to dist/bin when compiled)
|
|
16
|
+
// dist/bin/install-skills.js -> skills/image-generation
|
|
17
|
+
const SKILLS_SOURCE = (0, node_path_1.resolve)(__dirname, '..', '..', 'skills', 'image-generation');
|
|
18
|
+
const SKILL_DIR_NAME = 'image-generation';
|
|
19
|
+
function printHelp() {
|
|
20
|
+
console.log(`
|
|
21
|
+
Image Generation Skills Installer
|
|
22
|
+
|
|
23
|
+
Usage:
|
|
24
|
+
npx mcp-image skills install --path <path>
|
|
25
|
+
|
|
26
|
+
Options:
|
|
27
|
+
--path <path> Install skills to the specified directory.
|
|
28
|
+
The skill will be placed at <path>/image-generation/
|
|
29
|
+
|
|
30
|
+
--help, -h Show this help message
|
|
31
|
+
|
|
32
|
+
Examples:
|
|
33
|
+
npx mcp-image skills install --path ~/.claude/skills
|
|
34
|
+
npx mcp-image skills install --path ./.claude/skills
|
|
35
|
+
npx mcp-image skills install --path /custom/path
|
|
36
|
+
`);
|
|
37
|
+
}
|
|
38
|
+
function parseArgs(args) {
|
|
39
|
+
const options = { help: false };
|
|
40
|
+
for (let i = 0; i < args.length; i++) {
|
|
41
|
+
const arg = args[i];
|
|
42
|
+
switch (arg) {
|
|
43
|
+
case '--help':
|
|
44
|
+
case '-h':
|
|
45
|
+
options.help = true;
|
|
46
|
+
break;
|
|
47
|
+
case '--path': {
|
|
48
|
+
const pathArg = args[i + 1];
|
|
49
|
+
if (!pathArg) {
|
|
50
|
+
console.error('Error: --path requires a path argument');
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
options.path = pathArg;
|
|
54
|
+
i++;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
default:
|
|
58
|
+
if (arg?.startsWith('-')) {
|
|
59
|
+
console.error(`Unknown option: ${arg}`);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return options;
|
|
65
|
+
}
|
|
66
|
+
function install(targetPath) {
|
|
67
|
+
if (!(0, node_fs_1.existsSync)(SKILLS_SOURCE)) {
|
|
68
|
+
console.error(`Error: Skills source not found at ${SKILLS_SOURCE}`);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
const targetDir = (0, node_path_1.dirname)(targetPath);
|
|
72
|
+
if (!(0, node_fs_1.existsSync)(targetDir)) {
|
|
73
|
+
(0, node_fs_1.mkdirSync)(targetDir, { recursive: true });
|
|
74
|
+
console.log(`Created directory: ${targetDir}`);
|
|
75
|
+
}
|
|
76
|
+
(0, node_fs_1.cpSync)(SKILLS_SOURCE, targetPath, { recursive: true });
|
|
77
|
+
console.log(`Installed skills to: ${targetPath}`);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Run the skills installer with the given arguments
|
|
81
|
+
*/
|
|
82
|
+
function run(args) {
|
|
83
|
+
if (args.length === 0) {
|
|
84
|
+
printHelp();
|
|
85
|
+
process.exit(0);
|
|
86
|
+
}
|
|
87
|
+
const options = parseArgs(args);
|
|
88
|
+
if (options.help) {
|
|
89
|
+
printHelp();
|
|
90
|
+
process.exit(0);
|
|
91
|
+
}
|
|
92
|
+
if (!options.path) {
|
|
93
|
+
console.error('Error: --path is required');
|
|
94
|
+
console.error('Run "npx mcp-image skills install --help" for usage information.');
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
const targetPath = (0, node_path_1.resolve)(options.path, SKILL_DIR_NAME);
|
|
98
|
+
console.log('Installing image-generation skills...');
|
|
99
|
+
console.log(`Path: ${targetPath}`);
|
|
100
|
+
console.log();
|
|
101
|
+
install(targetPath);
|
|
102
|
+
console.log();
|
|
103
|
+
console.log('Installation complete!');
|
|
104
|
+
console.log();
|
|
105
|
+
console.log('Installed files:');
|
|
106
|
+
console.log(' - image-generation/SKILL.md');
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=install-skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-skills.js","sourceRoot":"","sources":["../../src/bin/install-skills.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAyFH,kBAiCC;AAxHD,qCAAuD;AACvD,yCAA4C;AAE5C,+DAA+D;AAC/D,wDAAwD;AACxD,MAAM,aAAa,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAA;AAElF,MAAM,cAAc,GAAG,kBAAkB,CAAA;AAEzC,SAAS,SAAS;IAChB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;CAgBb,CAAC,CAAA;AACF,CAAC;AAOD,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,OAAO,GAAY,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IAExC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CA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AG,CAAC,oDAAoD,CAAC,CAAA;AACnE,CAAC"}
|
|
@@ -28,9 +28,9 @@ Structure your enhancement around three core elements:
|
|
|
28
28
|
- Mood and emotional tone of the scene
|
|
29
29
|
|
|
30
30
|
3. STYLE (How): The visual treatment
|
|
31
|
-
- Artistic or photographic approach
|
|
31
|
+
- Artistic or photographic approach: reference specific artists, movements, or styles
|
|
32
32
|
- Lighting design: direction, quality, color temperature, shadows
|
|
33
|
-
- Camera/lens choices
|
|
33
|
+
- Camera/lens choices: specify focal length, aperture, and shooting angle when photographic
|
|
34
34
|
|
|
35
35
|
Core principles:
|
|
36
36
|
- Preserve the user's original intent while enhancing detail
|
|
@@ -72,7 +72,7 @@ class StructuredPromptGeneratorImpl {
|
|
|
72
72
|
// Generate structured prompt using Gemini 2.0 Flash via pure API call
|
|
73
73
|
const config = {
|
|
74
74
|
temperature: 0.7,
|
|
75
|
-
maxTokens:
|
|
75
|
+
maxTokens: 1000,
|
|
76
76
|
systemInstruction,
|
|
77
77
|
...(inputImageData && { inputImage: inputImageData }), // Only include if available
|
|
78
78
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MCP Image Generator - Entry Point Router
|
|
4
|
+
*
|
|
5
|
+
* Routes to:
|
|
6
|
+
* - skills install → bin/install-skills.js
|
|
7
|
+
* - (default) → MCP server startup
|
|
8
|
+
*/
|
|
2
9
|
export { createMCPServer, MCPServerImpl } from './server/mcpServer';
|
|
3
10
|
export type { GenerateImageParams, MCPServerConfig } from './types/mcp';
|
|
4
11
|
export type { GeneratedImageResult } from './api/geminiClient';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AAoBH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACnE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACvE,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,45 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.MCPServerImpl = exports.createMCPServer = void 0;
|
|
5
|
-
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
|
-
/**
|
|
7
|
-
* MCP Image Generator entry point
|
|
8
|
-
* MCP server startup process
|
|
9
|
-
*/
|
|
10
|
-
const mcpServer_1 = require("./server/mcpServer");
|
|
11
|
-
const logger_1 = require("./utils/logger");
|
|
12
|
-
const logger = new logger_1.Logger();
|
|
13
3
|
/**
|
|
14
|
-
*
|
|
4
|
+
* MCP Image Generator - Entry Point Router
|
|
5
|
+
*
|
|
6
|
+
* Routes to:
|
|
7
|
+
* - skills install → bin/install-skills.js
|
|
8
|
+
* - (default) → MCP server startup
|
|
15
9
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const transport = new stdio_js_1.StdioServerTransport();
|
|
26
|
-
await server.connect(transport);
|
|
27
|
-
logger.info('mcp-startup', 'Image Generator MCP Server started successfully');
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.MCPServerImpl = exports.createMCPServer = void 0;
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
if (args[0] === 'skills') {
|
|
15
|
+
if (args[1] === 'install') {
|
|
16
|
+
const { run } = require((0, node_path_1.resolve)(__dirname, '..', 'bin', 'install-skills.js'));
|
|
17
|
+
run(args.slice(2));
|
|
18
|
+
process.exit(0);
|
|
28
19
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
stack: error?.stack,
|
|
33
|
-
});
|
|
20
|
+
else {
|
|
21
|
+
console.error('Unknown skills subcommand. Usage: npx mcp-image skills install --path <path>');
|
|
22
|
+
console.error('Run "npx mcp-image skills install --help" for more information.');
|
|
34
23
|
process.exit(1);
|
|
35
24
|
}
|
|
36
25
|
}
|
|
37
|
-
|
|
38
|
-
main
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
Object.defineProperty(exports, "createMCPServer", { enumerable: true, get: function () { return mcpServer_2.createMCPServer; } });
|
|
44
|
-
Object.defineProperty(exports, "MCPServerImpl", { enumerable: true, get: function () { return mcpServer_2.MCPServerImpl; } });
|
|
26
|
+
else {
|
|
27
|
+
require('./server-main');
|
|
28
|
+
}
|
|
29
|
+
var mcpServer_1 = require("./server/mcpServer");
|
|
30
|
+
Object.defineProperty(exports, "createMCPServer", { enumerable: true, get: function () { return mcpServer_1.createMCPServer; } });
|
|
31
|
+
Object.defineProperty(exports, "MCPServerImpl", { enumerable: true, get: function () { return mcpServer_1.MCPServerImpl; } });
|
|
45
32
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA;;;;;;GAMG;;;AAEH,yCAAmC;AAEnC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAElC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;IACzB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAA,mBAAO,EAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAA;QAC7E,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAA;QAC7F,OAAO,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAA;QAChF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,eAAe,CAAC,CAAA;AAC1B,CAAC;AAED,gDAAmE;AAA1D,4GAAA,eAAe,OAAA;AAAE,0GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-main.d.ts","sourceRoot":"","sources":["../src/server-main.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP Image Generator - Server Entry Point
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
7
|
+
const mcpServer_1 = require("./server/mcpServer");
|
|
8
|
+
const logger_1 = require("./utils/logger");
|
|
9
|
+
const logger = new logger_1.Logger();
|
|
10
|
+
/**
|
|
11
|
+
* Application startup
|
|
12
|
+
*/
|
|
13
|
+
async function main() {
|
|
14
|
+
try {
|
|
15
|
+
logger.info('mcp-startup', 'Starting MCP Image Generator initialization', {
|
|
16
|
+
nodeVersion: process.version,
|
|
17
|
+
platform: process.platform,
|
|
18
|
+
env: process.env['NODE_ENV'] || 'development',
|
|
19
|
+
});
|
|
20
|
+
const mcpServerImpl = new mcpServer_1.MCPServerImpl();
|
|
21
|
+
const server = mcpServerImpl.initialize();
|
|
22
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
23
|
+
await server.connect(transport);
|
|
24
|
+
logger.info('mcp-startup', 'Image Generator MCP Server started successfully');
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
logger.error('mcp-startup', 'Failed to start MCP server', error, {
|
|
28
|
+
errorType: error?.constructor?.name,
|
|
29
|
+
stack: error?.stack,
|
|
30
|
+
});
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Run main function
|
|
35
|
+
main().catch((error) => {
|
|
36
|
+
logger.error('mcp-startup', 'Fatal error during startup', error);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=server-main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-main.js","sourceRoot":"","sources":["../src/server-main.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,wEAAgF;AAChF,kDAAkD;AAClD,2CAAuC;AAEvC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAA;AAE3B;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,6CAA6C,EAAE;YACxE,WAAW,EAAE,OAAO,CAAC,OAAO;YAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,aAAa;SAC9C,CAAC,CAAA;QAEF,MAAM,aAAa,GAAG,IAAI,yBAAa,EAAE,CAAA;QAEzC,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,EAAE,CAAA;QAEzC,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAA;QAE5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAE/B,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,iDAAiD,CAAC,CAAA;IAC/E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,4BAA4B,EAAE,KAAc,EAAE;YACxE,SAAS,EAAG,KAAe,EAAE,WAAW,EAAE,IAAI;YAC9C,KAAK,EAAG,KAAe,EAAE,KAAK;SAC/B,CAAC,CAAA;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;AAED,oBAAoB;AACpB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,4BAA4B,EAAE,KAAc,CAAC,CAAA;IACzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-image",
|
|
3
3
|
"mcpName": "io.github.shinpr/mcp-image",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"description": "MCP server for AI image generation",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
"claude-code",
|
|
22
22
|
"cursor",
|
|
23
23
|
"codex",
|
|
24
|
-
"typescript"
|
|
24
|
+
"typescript",
|
|
25
|
+
"agent-skills",
|
|
26
|
+
"skills"
|
|
25
27
|
],
|
|
26
28
|
"author": "Shinsuke Kagawa",
|
|
27
29
|
"license": "MIT",
|
|
@@ -34,7 +36,9 @@
|
|
|
34
36
|
"!dist/**/*.test.js",
|
|
35
37
|
"!dist/**/*.test.d.ts",
|
|
36
38
|
"!dist/__tests__",
|
|
37
|
-
"!dist/tests"
|
|
39
|
+
"!dist/tests",
|
|
40
|
+
"bin",
|
|
41
|
+
"skills"
|
|
38
42
|
],
|
|
39
43
|
"scripts": {
|
|
40
44
|
"build": "tsc && tsc-alias",
|
|
@@ -58,7 +62,7 @@
|
|
|
58
62
|
"test:safe": "npm test && npm run cleanup:processes"
|
|
59
63
|
},
|
|
60
64
|
"dependencies": {
|
|
61
|
-
"@google/genai": "^1.
|
|
65
|
+
"@google/genai": "^1.42.0",
|
|
62
66
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
63
67
|
},
|
|
64
68
|
"devDependencies": {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: image-generation
|
|
3
|
+
description: Enhances image generation prompts using Subject-Context-Style structure and best practices. Use this skill when generating images, creating illustrations, photos, visual assets, editing images, or crafting prompts for image generation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Image Generation Prompt Best Practices
|
|
7
|
+
|
|
8
|
+
## Prompt Structure
|
|
9
|
+
|
|
10
|
+
Enhance every image generation prompt around three core elements:
|
|
11
|
+
|
|
12
|
+
### 1. SUBJECT (What)
|
|
13
|
+
|
|
14
|
+
The main focus of the image.
|
|
15
|
+
|
|
16
|
+
- Physical characteristics: textures, materials, colors, scale
|
|
17
|
+
- Actions, poses, expressions if applicable
|
|
18
|
+
- Distinctive features that define the subject
|
|
19
|
+
|
|
20
|
+
### 2. CONTEXT (Where/When)
|
|
21
|
+
|
|
22
|
+
The environment and conditions.
|
|
23
|
+
|
|
24
|
+
- Setting, background, spatial relationships (foreground, midground, background)
|
|
25
|
+
- Time of day, weather, atmospheric conditions
|
|
26
|
+
- Mood and emotional tone of the scene
|
|
27
|
+
|
|
28
|
+
### 3. STYLE (How)
|
|
29
|
+
|
|
30
|
+
The visual treatment.
|
|
31
|
+
|
|
32
|
+
- Artistic or photographic approach: reference specific artists, movements, or styles
|
|
33
|
+
- Lighting design: direction, quality, color temperature, shadows
|
|
34
|
+
- Camera/lens choices: specify focal length, aperture, and shooting angle when photographic
|
|
35
|
+
|
|
36
|
+
## Core Principles
|
|
37
|
+
|
|
38
|
+
- **Preserve intent** — Enrich the user's original vision, never override it
|
|
39
|
+
- **Positive descriptions only** — Describe what should be present; rephrase any exclusion as an inclusion
|
|
40
|
+
- **Specific over vague** — "golden hour sunlight at 15° angle" beats "nice lighting"
|
|
41
|
+
- **Natural flow** — Weave elements into a single flowing description, not a bullet list
|
|
42
|
+
|
|
43
|
+
## Enhancement Patterns
|
|
44
|
+
|
|
45
|
+
### Hyper-Specific Details
|
|
46
|
+
|
|
47
|
+
Add concrete visual details where the user left gaps:
|
|
48
|
+
|
|
49
|
+
- Lighting → direction, quality, color temperature, shadow behavior
|
|
50
|
+
- Textures → surface materials, weathering, reflectivity
|
|
51
|
+
- Atmosphere → particulates, humidity, depth haze
|
|
52
|
+
- Scale → relative sizes, distances, proportions
|
|
53
|
+
|
|
54
|
+
### Camera Control Terminology
|
|
55
|
+
|
|
56
|
+
When a photographic look is appropriate:
|
|
57
|
+
|
|
58
|
+
- Lens type: "shot with 85mm portrait lens", "wide-angle 24mm"
|
|
59
|
+
- Aperture: "shallow depth of field at f/1.8", "deep focus at f/11"
|
|
60
|
+
- Angle: "low angle emphasizing height", "bird's eye view"
|
|
61
|
+
- Motion: "motion blur on the paws", "frozen mid-action"
|
|
62
|
+
|
|
63
|
+
### Atmospheric Enhancement
|
|
64
|
+
|
|
65
|
+
Convey mood through environmental details:
|
|
66
|
+
|
|
67
|
+
- Emotional tone: "serene", "ominous", "jubilant"
|
|
68
|
+
- Light quality: "dappled shadows", "harsh midday sun", "soft diffused overcast"
|
|
69
|
+
- Weather/air: "morning mist", "dust particles in a sunbeam"
|
|
70
|
+
|
|
71
|
+
### Text in Images
|
|
72
|
+
|
|
73
|
+
When the image should contain readable text (signs, labels, titles, typography):
|
|
74
|
+
|
|
75
|
+
- Specify the exact text content in quotes: `"OPEN 24 HOURS" in bold sans-serif`
|
|
76
|
+
- Describe visual treatment: font style, weight, size relative to the scene
|
|
77
|
+
- Define placement and integration: "centered on the storefront awning", "hand-lettered on the chalkboard"
|
|
78
|
+
|
|
79
|
+
## Feature Patterns
|
|
80
|
+
|
|
81
|
+
### Character Consistency
|
|
82
|
+
|
|
83
|
+
When the same character must be recognizable across multiple images:
|
|
84
|
+
|
|
85
|
+
- Include **at least 3 recognizable visual markers** (distinctive scar, signature clothing, unique hairstyle, characteristic accessory)
|
|
86
|
+
- Use anchoring words: "distinctive", "signature", "always wears", "always has"
|
|
87
|
+
- Be specific: "round tortoiseshell glasses" not just "glasses"
|
|
88
|
+
|
|
89
|
+
### Compositional Integration (Multi-Element Blending)
|
|
90
|
+
|
|
91
|
+
When combining multiple visual elements in one scene:
|
|
92
|
+
|
|
93
|
+
- Define spatial relationships with proportions: "foreground (40% of frame)", "midground", "background"
|
|
94
|
+
- Use integration language: "seamlessly blending", "harmoniously composed", "naturally integrated"
|
|
95
|
+
- Specify relative scale and interaction between elements
|
|
96
|
+
|
|
97
|
+
### Real-World Accuracy
|
|
98
|
+
|
|
99
|
+
When depicting real places, cultures, or historical elements:
|
|
100
|
+
|
|
101
|
+
- Use specific terminology: "traditional Edo-period architecture", "authentic Moroccan zellige tilework"
|
|
102
|
+
- Include culturally accurate details
|
|
103
|
+
- Reference geographical or historical specifics
|
|
104
|
+
|
|
105
|
+
### Purpose-Driven Enhancement
|
|
106
|
+
|
|
107
|
+
Tailor the prompt to the intended use:
|
|
108
|
+
|
|
109
|
+
| Purpose | Emphasis |
|
|
110
|
+
|---------|----------|
|
|
111
|
+
| Product photo | Clean background, studio lighting, commercial appeal |
|
|
112
|
+
| UI mockup | Flat design elements, consistent spacing, screen-appropriate |
|
|
113
|
+
| Presentation slide | Bold composition, clear focal point, text-friendly layout |
|
|
114
|
+
| Social media | Eye-catching, vibrant, crop-friendly aspect ratio |
|
|
115
|
+
| Book/album cover | Typography space, dramatic mood, symbolic elements |
|
|
116
|
+
|
|
117
|
+
## Image Editing
|
|
118
|
+
|
|
119
|
+
When modifying an existing image:
|
|
120
|
+
|
|
121
|
+
- **Preserve** the original's core characteristics: color palette, lighting style, composition
|
|
122
|
+
- Use anchoring phrases: "maintain the existing...", "preserve the original...", "keep the same..."
|
|
123
|
+
- Be specific about what to change vs what to keep unchanged
|
|
124
|
+
- Describe modifications relative to the existing image, not from scratch
|
|
125
|
+
|
|
126
|
+
## Example
|
|
127
|
+
|
|
128
|
+
**Input:** "A happy dog in a park"
|
|
129
|
+
|
|
130
|
+
**Enhanced:** "Golden retriever mid-leap catching a red frisbee, ears flying, tongue out in joy, in a sunlit urban park. Soft morning light filtering through oak trees creates dappled shadows on emerald grass. Background shows families on picnic blankets, slightly out of focus. Shot from low angle emphasizing the dog's athletic movement, with motion blur on the paws suggesting speed."
|
|
131
|
+
|