@umituz/react-native-ai-generation-content 1.17.170 → 1.17.171
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/package.json +1 -1
- package/src/domains/prompts/infrastructure/services/BackgroundRemovalService.ts +36 -170
- package/src/domains/prompts/infrastructure/services/ColorizationService.ts +43 -185
- package/src/domains/prompts/infrastructure/services/FaceSwapService.ts +52 -143
- package/src/domains/prompts/infrastructure/services/FuturePredictionService.ts +98 -169
- package/src/domains/prompts/infrastructure/services/ImageEnhancementService.ts +35 -141
- package/src/domains/prompts/infrastructure/services/PhotoRestorationService.ts +43 -121
- package/src/domains/prompts/infrastructure/services/StyleTransferService.ts +50 -150
- package/src/domains/prompts/infrastructure/services/TextGenerationService.ts +41 -192
- package/src/domains/prompts/infrastructure/services/base/index.ts +6 -0
- package/src/domains/prompts/infrastructure/services/base/prompt-service.base.ts +112 -0
package/package.json
CHANGED
|
@@ -1,114 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Background Removal Service
|
|
3
|
+
* AI prompt generation for background removal tasks
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
import type { IBackgroundRemovalService } from '../../domain/repositories/IAIPromptServices';
|
|
2
|
-
import type {
|
|
3
|
-
BackgroundRemovalConfig,
|
|
4
|
-
} from '../../domain/entities/BackgroundRemovalConfig';
|
|
7
|
+
import type { BackgroundRemovalConfig } from '../../domain/entities/BackgroundRemovalConfig';
|
|
5
8
|
import type { AIPromptTemplate } from '../../domain/entities/AIPromptTemplate';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
validateBackgroundRemovalConfig,
|
|
10
|
-
getProcessingTime,
|
|
11
|
-
getQualityScore
|
|
12
|
-
} from '../../domain/entities/BackgroundRemovalConfig';
|
|
13
|
-
import { PromptGenerationService } from '../services/PromptGenerationService';
|
|
14
|
-
|
|
15
|
-
const createBackgroundRemovalBaseTemplate = (config?: {
|
|
16
|
-
precision?: string;
|
|
17
|
-
edgeRefinement?: boolean;
|
|
18
|
-
}): string => {
|
|
19
|
-
const {
|
|
20
|
-
precision = 'accurate',
|
|
21
|
-
edgeRefinement = true
|
|
22
|
-
} = config || {};
|
|
9
|
+
import { validateBackgroundRemovalConfig, getProcessingTime, getQualityScore } from '../../domain/entities/BackgroundRemovalConfig';
|
|
10
|
+
import { BasePromptService } from './base';
|
|
23
11
|
|
|
24
|
-
|
|
12
|
+
const BASE_TEMPLATE = `
|
|
25
13
|
You are an expert AI background removal specialist.
|
|
26
14
|
This is a BACKGROUND REMOVAL task, not image generation.
|
|
27
15
|
|
|
28
|
-
BACKGROUND REMOVAL OBJECTIVES:
|
|
29
|
-
- Remove background with ${precision} precision
|
|
30
|
-
- ${edgeRefinement ? 'Refine edges for clean cutout' : 'Focus on speed over precision'}
|
|
31
|
-
- Preserve subject integrity and details
|
|
32
|
-
- Create professional-quality transparency
|
|
33
|
-
|
|
34
16
|
DETECTION PRINCIPLES:
|
|
35
17
|
- Accurately identify foreground subject
|
|
36
18
|
- Distinguish between subject and background
|
|
37
19
|
- Handle complex edges (hair, fur, transparent objects)
|
|
38
20
|
- Preserve fine details and textures
|
|
39
21
|
|
|
40
|
-
TECHNICAL REQUIREMENTS:
|
|
41
|
-
${precision === 'ultra-accurate' ?
|
|
42
|
-
`- Maximum precision processing
|
|
43
|
-
- Advanced edge detection algorithms
|
|
44
|
-
- Multiple refinement passes
|
|
45
|
-
- Subpixel accuracy for edges` :
|
|
46
|
-
precision === 'accurate' ?
|
|
47
|
-
`- Standard precision processing
|
|
48
|
-
- Reliable edge detection
|
|
49
|
-
- Single refinement pass
|
|
50
|
-
- Good balance of speed/quality` :
|
|
51
|
-
`- Fast processing optimization
|
|
52
|
-
- Basic edge detection
|
|
53
|
-
- Quick subject isolation
|
|
54
|
-
- Suitable for simple backgrounds`}
|
|
55
|
-
|
|
56
|
-
EDGE HANDLING:
|
|
57
|
-
${edgeRefinement ?
|
|
58
|
-
`- Feather edges naturally
|
|
59
|
-
- Preserve hair and fine details
|
|
60
|
-
- Remove halos and artifacts
|
|
61
|
-
- Smooth transitions` :
|
|
62
|
-
`- Focus on speed
|
|
63
|
-
- Basic edge processing
|
|
64
|
-
- Minimal refinement
|
|
65
|
-
- Quick turnaround time`}
|
|
66
|
-
|
|
67
22
|
SAFETY CONSTRAINTS:
|
|
68
23
|
- Preserve subject completely
|
|
69
24
|
- Do not alter foreground content
|
|
70
25
|
- Maintain important details
|
|
71
26
|
- Avoid over-removal of subject elements
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
private promptService: PromptGenerationService;
|
|
81
|
-
|
|
82
|
-
constructor() {
|
|
83
|
-
this.promptService = new PromptGenerationService();
|
|
27
|
+
`.trim();
|
|
28
|
+
|
|
29
|
+
export class BackgroundRemovalService
|
|
30
|
+
extends BasePromptService<BackgroundRemovalConfig>
|
|
31
|
+
implements IBackgroundRemovalService
|
|
32
|
+
{
|
|
33
|
+
protected getServiceName(): string {
|
|
34
|
+
return 'background removal';
|
|
84
35
|
}
|
|
85
36
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return Promise.resolve({
|
|
90
|
-
success: false,
|
|
91
|
-
error: 'VALIDATION_ERROR',
|
|
92
|
-
message: 'Invalid background removal configuration'
|
|
93
|
-
});
|
|
94
|
-
}
|
|
37
|
+
validateConfig(config: BackgroundRemovalConfig): boolean {
|
|
38
|
+
return validateBackgroundRemovalConfig(config);
|
|
39
|
+
}
|
|
95
40
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} catch {
|
|
99
|
-
return Promise.resolve({
|
|
100
|
-
success: false,
|
|
101
|
-
error: 'GENERATION_FAILED',
|
|
102
|
-
message: 'Failed to generate background removal template'
|
|
103
|
-
});
|
|
104
|
-
}
|
|
41
|
+
estimateProcessingTime(config: BackgroundRemovalConfig): number {
|
|
42
|
+
return getProcessingTime(config.precision);
|
|
105
43
|
}
|
|
106
44
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
config: BackgroundRemovalConfig
|
|
110
|
-
): Promise<AIPromptResult<string>> {
|
|
111
|
-
const variables = {
|
|
45
|
+
protected buildVariables(config: BackgroundRemovalConfig): Record<string, unknown> {
|
|
46
|
+
return {
|
|
112
47
|
precision: config.precision,
|
|
113
48
|
edgeRefinement: config.edgeRefinement,
|
|
114
49
|
preserveHair: config.preserveHair,
|
|
@@ -117,93 +52,24 @@ export class BackgroundRemovalService implements IBackgroundRemovalService {
|
|
|
117
52
|
processingTime: getProcessingTime(config.precision),
|
|
118
53
|
qualityScore: getQualityScore(config),
|
|
119
54
|
};
|
|
120
|
-
|
|
121
|
-
return this.promptService.generateFromTemplate(template, variables);
|
|
122
55
|
}
|
|
123
56
|
|
|
124
|
-
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
estimateProcessingTime(config: BackgroundRemovalConfig): number {
|
|
129
|
-
return getProcessingTime(config.precision);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
private createBackgroundRemovalTemplate(config: BackgroundRemovalConfig): AIPromptTemplate {
|
|
133
|
-
const templateId = `background-removal-${config.precision}`;
|
|
134
|
-
|
|
135
|
-
const baseTemplate = createBackgroundRemovalBaseTemplate({
|
|
136
|
-
precision: config.precision,
|
|
137
|
-
edgeRefinement: config.edgeRefinement,
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
return createAIPromptTemplate({
|
|
141
|
-
id: templateId,
|
|
57
|
+
protected createTemplate(config: BackgroundRemovalConfig): AIPromptTemplate {
|
|
58
|
+
return this.createTemplateWithDefaults({
|
|
59
|
+
id: `background-removal-${config.precision}`,
|
|
142
60
|
name: `Background Removal: ${config.precision}`,
|
|
143
61
|
description: `Remove background with ${config.precision} precision`,
|
|
144
62
|
category: 'background-removal',
|
|
145
|
-
template: `${
|
|
146
|
-
|
|
147
|
-
REMOVAL CONFIGURATION:
|
|
148
|
-
- Precision Level: ${config.precision}
|
|
149
|
-
- Edge Refinement: ${config.edgeRefinement}
|
|
150
|
-
- Preserve Hair: ${config.preserveHair}
|
|
151
|
-
- Output Format: ${config.outputFormat}
|
|
152
|
-
${config.addNewBackground ? `- New Background: ${config.addNewBackground}` : ''}
|
|
63
|
+
template: `${BASE_TEMPLATE}
|
|
153
64
|
|
|
154
|
-
|
|
155
|
-
${
|
|
65
|
+
PRECISION: ${config.precision}
|
|
66
|
+
EDGE REFINEMENT: ${config.edgeRefinement}
|
|
67
|
+
PRESERVE HAIR: ${config.preserveHair}
|
|
68
|
+
OUTPUT: ${config.outputFormat}
|
|
69
|
+
${config.addNewBackground ? `NEW BACKGROUND: ${config.addNewBackground}` : ''}
|
|
156
70
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
- Quality Score: ${Math.round(getQualityScore(config) * 100)}%
|
|
160
|
-
- Edge Detail: ${config.edgeRefinement ? 'High precision' : 'Standard precision'}
|
|
161
|
-
- Hair Handling: ${config.preserveHair ? 'Preserved with detail' : 'Standard processing'}
|
|
162
|
-
|
|
163
|
-
OUTPUT FORMAT:
|
|
164
|
-
${config.outputFormat === 'transparent' ? 'Transparent PNG with alpha channel' :
|
|
165
|
-
config.outputFormat === 'png' ? 'PNG format with transparency' :
|
|
166
|
-
'WebP format with transparency support'}
|
|
167
|
-
|
|
168
|
-
${config.addNewBackground ? `NEW BACKGROUND:
|
|
169
|
-
Replace removed background with: ${config.addNewBackground}
|
|
170
|
-
Ensure proper blending and integration with subject.` : ''}
|
|
171
|
-
|
|
172
|
-
EXPECTED RESULT:
|
|
173
|
-
Clean subject with background removed,
|
|
174
|
-
${config.edgeRefinement ? 'with refined edges and preserved details' : 'with standard edge quality'},
|
|
175
|
-
ready for ${config.outputFormat} output.
|
|
176
|
-
`.trim(),
|
|
177
|
-
variables: [],
|
|
178
|
-
safety: {
|
|
179
|
-
contentFilter: true,
|
|
180
|
-
adultContentFilter: true,
|
|
181
|
-
violenceFilter: true,
|
|
182
|
-
hateSpeechFilter: true,
|
|
183
|
-
copyrightFilter: true,
|
|
184
|
-
},
|
|
185
|
-
version: '1.0.0',
|
|
71
|
+
QUALITY: ${Math.round(getQualityScore(config) * 100)}%
|
|
72
|
+
EST. TIME: ${getProcessingTime(config.precision)}s`,
|
|
186
73
|
});
|
|
187
74
|
}
|
|
188
|
-
|
|
189
|
-
private getSpecificRequirements(config: BackgroundRemovalConfig): string {
|
|
190
|
-
const requirements: string[] = [];
|
|
191
|
-
|
|
192
|
-
if (config.preserveHair) {
|
|
193
|
-
requirements.push('- Advanced hair detection and preservation');
|
|
194
|
-
requirements.push('- Fine strand handling and transparency');
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (config.edgeRefinement) {
|
|
198
|
-
requirements.push('- Subpixel edge accuracy');
|
|
199
|
-
requirements.push('- Natural feathering and anti-aliasing');
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (config.precision === 'ultra-accurate') {
|
|
203
|
-
requirements.push('- Multi-pass refinement processing');
|
|
204
|
-
requirements.push('- Advanced artifact removal');
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return requirements.join('\n') || '- Standard background removal processing';
|
|
208
|
-
}
|
|
209
|
-
}
|
|
75
|
+
}
|
|
@@ -1,118 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colorization Service
|
|
3
|
+
* AI prompt generation for photo colorization
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
import type { IColorizationService } from '../../domain/repositories/IAIPromptServices';
|
|
2
|
-
import type {
|
|
3
|
-
ColorizationConfig,
|
|
4
|
-
} from '../../domain/entities/ColorizationConfig';
|
|
7
|
+
import type { ColorizationConfig } from '../../domain/entities/ColorizationConfig';
|
|
5
8
|
import type { AIPromptTemplate } from '../../domain/entities/AIPromptTemplate';
|
|
6
|
-
import type { AIPromptResult } from '../../domain/entities/types';
|
|
7
|
-
import { createAIPromptTemplate } from '../../domain/entities/AIPromptTemplate';
|
|
8
9
|
import {
|
|
9
10
|
validateColorizationConfig,
|
|
10
11
|
getColorizationQuality,
|
|
11
|
-
|
|
12
|
-
getSuggestedColorPalette
|
|
12
|
+
getSuggestedColorPalette,
|
|
13
13
|
} from '../../domain/entities/ColorizationConfig';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
const createColorizationBaseTemplate = (config?: {
|
|
17
|
-
targetType?: string;
|
|
18
|
-
colorMode?: string;
|
|
19
|
-
}): string => {
|
|
20
|
-
const {
|
|
21
|
-
targetType = 'black-and-white',
|
|
22
|
-
colorMode = 'realistic'
|
|
23
|
-
} = config || {};
|
|
14
|
+
import { BasePromptService } from './base';
|
|
24
15
|
|
|
25
|
-
|
|
16
|
+
const BASE_TEMPLATE = `
|
|
26
17
|
You are an expert AI colorization specialist.
|
|
27
18
|
This is a PHOTO COLORIZATION task, not image generation.
|
|
28
19
|
|
|
29
|
-
COLORIZATION OBJECTIVES:
|
|
30
|
-
- Add appropriate colors to ${targetType} images
|
|
31
|
-
- Apply ${colorMode} color treatment while preserving authenticity
|
|
32
|
-
- Maintain original composition and details
|
|
33
|
-
- Create natural, pleasing color relationships
|
|
34
|
-
|
|
35
20
|
COLORIZATION PRINCIPLES:
|
|
36
21
|
- Research appropriate color schemes for image era/content
|
|
37
22
|
- Apply colors that match scene context and lighting
|
|
38
23
|
- Preserve details and textures while adding color
|
|
39
|
-
- Ensure color harmony and balance
|
|
40
|
-
|
|
41
|
-
${colorMode === 'realistic' ?
|
|
42
|
-
`REALISTIC COLORIZATION:
|
|
43
|
-
- Use historically accurate colors when appropriate
|
|
44
|
-
- Consider natural lighting conditions
|
|
45
|
-
- Apply realistic skin tones and environmental colors
|
|
46
|
-
- Maintain photographic authenticity` :
|
|
47
|
-
colorMode === 'vibrant' ?
|
|
48
|
-
`VIBRANT COLORIZATION:
|
|
49
|
-
- Use rich, saturated colors for visual impact
|
|
50
|
-
- Create bold color contrasts and relationships
|
|
51
|
-
- Apply artistic color interpretations
|
|
52
|
-
- Enhance visual interest and appeal` :
|
|
53
|
-
colorMode === 'artistic' ?
|
|
54
|
-
`ARTISTIC COLORIZATION:
|
|
55
|
-
- Apply creative color interpretations
|
|
56
|
-
- Use expressive color choices and combinations
|
|
57
|
-
- Create mood and atmosphere through color
|
|
58
|
-
- Allow artistic freedom in color selection` :
|
|
59
|
-
`VINTAGE COLORIZATION:
|
|
60
|
-
- Use period-appropriate color palettes
|
|
61
|
-
- Apply aged, authentic color treatments
|
|
62
|
-
- Maintain historical color sensibilities
|
|
63
|
-
- Create nostalgic, time-appropriate appearance`}
|
|
24
|
+
- Ensure color harmony and balance
|
|
64
25
|
|
|
65
|
-
TECHNICAL
|
|
26
|
+
TECHNICAL:
|
|
66
27
|
- Preserve edges and details during color application
|
|
67
28
|
- Apply colors smoothly and naturally
|
|
68
29
|
- Consider lighting and shadow relationships
|
|
69
|
-
- Maintain image quality and resolution
|
|
70
30
|
|
|
71
|
-
SAFETY
|
|
31
|
+
SAFETY:
|
|
72
32
|
- Do not alter content or composition
|
|
73
33
|
- Preserve important details and features
|
|
74
34
|
- Avoid inappropriate or unrealistic colors
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
private promptService: PromptGenerationService;
|
|
35
|
+
`.trim();
|
|
36
|
+
|
|
37
|
+
export class ColorizationService
|
|
38
|
+
extends BasePromptService<ColorizationConfig>
|
|
39
|
+
implements IColorizationService
|
|
40
|
+
{
|
|
41
|
+
protected getServiceName(): string {
|
|
42
|
+
return 'colorization';
|
|
43
|
+
}
|
|
85
44
|
|
|
86
|
-
|
|
87
|
-
|
|
45
|
+
validateConfig(config: ColorizationConfig): boolean {
|
|
46
|
+
return validateColorizationConfig(config);
|
|
88
47
|
}
|
|
89
48
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return Promise.resolve({
|
|
94
|
-
success: false,
|
|
95
|
-
error: 'VALIDATION_ERROR',
|
|
96
|
-
message: 'Invalid colorization configuration'
|
|
97
|
-
});
|
|
98
|
-
}
|
|
49
|
+
getColorPalette(config: ColorizationConfig): string[] {
|
|
50
|
+
return getSuggestedColorPalette(config.targetType, config.colorMode);
|
|
51
|
+
}
|
|
99
52
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
} catch {
|
|
103
|
-
return Promise.resolve({
|
|
104
|
-
success: false,
|
|
105
|
-
error: 'GENERATION_FAILED',
|
|
106
|
-
message: 'Failed to generate colorization template'
|
|
107
|
-
});
|
|
108
|
-
}
|
|
53
|
+
getQualityScore(config: ColorizationConfig): number {
|
|
54
|
+
return getColorizationQuality(config);
|
|
109
55
|
}
|
|
110
56
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
config: ColorizationConfig
|
|
114
|
-
): Promise<AIPromptResult<string>> {
|
|
115
|
-
const variables = {
|
|
57
|
+
protected buildVariables(config: ColorizationConfig): Record<string, unknown> {
|
|
58
|
+
return {
|
|
116
59
|
targetType: config.targetType,
|
|
117
60
|
colorMode: config.colorMode,
|
|
118
61
|
preserveOriginal: config.preserveOriginal,
|
|
@@ -122,111 +65,26 @@ export class ColorizationService implements IColorizationService {
|
|
|
122
65
|
qualityScore: getColorizationQuality(config),
|
|
123
66
|
colorPalette: this.getColorPalette(config),
|
|
124
67
|
};
|
|
125
|
-
|
|
126
|
-
return this.promptService.generateFromTemplate(template, variables);
|
|
127
68
|
}
|
|
128
69
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
getColorPalette(config: ColorizationConfig): string[] {
|
|
134
|
-
return getSuggestedColorPalette(config.targetType, config.colorMode);
|
|
135
|
-
}
|
|
70
|
+
protected createTemplate(config: ColorizationConfig): AIPromptTemplate {
|
|
71
|
+
const quality = Math.round(getColorizationQuality(config) * 100);
|
|
136
72
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
private createColorizationTemplate(config: ColorizationConfig): AIPromptTemplate {
|
|
142
|
-
const templateId = `colorization-${config.targetType}-${config.colorMode}`;
|
|
143
|
-
|
|
144
|
-
const baseTemplate = createColorizationBaseTemplate({
|
|
145
|
-
targetType: config.targetType,
|
|
146
|
-
colorMode: config.colorMode,
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
return createAIPromptTemplate({
|
|
150
|
-
id: templateId,
|
|
73
|
+
return this.createTemplateWithDefaults({
|
|
74
|
+
id: `colorization-${config.targetType}-${config.colorMode}`,
|
|
151
75
|
name: `Colorization: ${config.targetType} to ${config.colorMode}`,
|
|
152
76
|
description: `Colorize ${config.targetType} images with ${config.colorMode} treatment`,
|
|
153
77
|
category: 'colorization',
|
|
154
|
-
template: `${
|
|
155
|
-
|
|
156
|
-
COLORIZATION CONFIGURATION:
|
|
157
|
-
- Target Type: ${config.targetType}
|
|
158
|
-
- Color Mode: ${config.colorMode}
|
|
159
|
-
- Preserve Original: ${config.preserveOriginal}
|
|
160
|
-
- Adjust Lighting: ${config.adjustLighting}
|
|
161
|
-
- Skin Tone Preservation: ${config.skinTonePreservation}
|
|
162
|
-
${config.era ? `- Era: ${config.era}` : ''}
|
|
163
|
-
|
|
164
|
-
COLOR REQUIREMENTS:
|
|
165
|
-
${this.getColorRequirements(config)}
|
|
78
|
+
template: `${BASE_TEMPLATE}
|
|
166
79
|
|
|
167
|
-
${config.
|
|
168
|
-
${
|
|
80
|
+
TARGET: ${config.targetType}
|
|
81
|
+
MODE: ${config.colorMode}
|
|
82
|
+
PRESERVE ORIGINAL: ${config.preserveOriginal}
|
|
83
|
+
ADJUST LIGHTING: ${config.adjustLighting}
|
|
84
|
+
SKIN TONE PRESERVATION: ${config.skinTonePreservation}
|
|
85
|
+
${config.era ? `ERA: ${config.era}` : ''}
|
|
169
86
|
|
|
170
|
-
|
|
171
|
-
- Quality Score: ${Math.round(getColorizationQuality(config) * 100)}%
|
|
172
|
-
- Color Mode: ${config.colorMode} treatment applied
|
|
173
|
-
- Preserved Elements: ${config.preserveOriginal ? 'Original content preserved' : 'Enhanced interpretation'}
|
|
174
|
-
- Skin Handling: ${config.skinTonePreservation ? 'Natural tones preserved' : 'Artistic interpretation allowed'}
|
|
175
|
-
|
|
176
|
-
${this.getColorPalette(config).length > 0 ? `
|
|
177
|
-
SUGGESTED COLOR PALETTE:
|
|
178
|
-
${this.getColorPalette(config).join(', ')}
|
|
179
|
-
|
|
180
|
-
` : ''}EXPECTED RESULT:
|
|
181
|
-
Professionally colorized ${config.targetType} image,
|
|
182
|
-
with ${config.colorMode} color treatment,
|
|
183
|
-
${config.skinTonePreservation ? 'maintaining natural appearance' : 'allowing artistic interpretation'}.
|
|
184
|
-
`.trim(),
|
|
185
|
-
variables: [],
|
|
186
|
-
safety: {
|
|
187
|
-
contentFilter: true,
|
|
188
|
-
adultContentFilter: true,
|
|
189
|
-
violenceFilter: true,
|
|
190
|
-
hateSpeechFilter: true,
|
|
191
|
-
copyrightFilter: true,
|
|
192
|
-
},
|
|
193
|
-
version: '1.0.0',
|
|
87
|
+
QUALITY: ${quality}%`,
|
|
194
88
|
});
|
|
195
89
|
}
|
|
196
|
-
|
|
197
|
-
private getColorRequirements(config: ColorizationConfig): string {
|
|
198
|
-
const requirements: string[] = [];
|
|
199
|
-
|
|
200
|
-
if (config.targetType === 'black-and-white') {
|
|
201
|
-
requirements.push('- Add natural colors to monochrome image');
|
|
202
|
-
requirements.push('- Consider original grayscale values for color mapping');
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (config.targetType === 'sepia') {
|
|
206
|
-
requirements.push('- Refresh and enhance sepia-toned image');
|
|
207
|
-
requirements.push('- Maintain vintage character while adding color');
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (config.colorMode === 'realistic') {
|
|
211
|
-
requirements.push('- Use historically and naturally accurate colors');
|
|
212
|
-
requirements.push('- Apply appropriate skin tones and environmental colors');
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (config.colorMode === 'vibrant') {
|
|
216
|
-
requirements.push('- Use rich, saturated colors for visual impact');
|
|
217
|
-
requirements.push('- Create bold color contrasts and relationships');
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (config.adjustLighting) {
|
|
221
|
-
requirements.push('- Adjust colors for optimal lighting conditions');
|
|
222
|
-
requirements.push('- Ensure appropriate contrast and brightness');
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (config.skinTonePreservation) {
|
|
226
|
-
requirements.push('- Maintain natural, appropriate skin tones');
|
|
227
|
-
requirements.push('- Avoid unrealistic or inappropriate skin colors');
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return requirements.join('\n') || '- Apply appropriate color treatment based on configuration';
|
|
231
|
-
}
|
|
232
|
-
}
|
|
90
|
+
}
|