@umituz/react-native-ai-generation-content 1.20.5 → 1.20.7
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/features/audio-generation/README.md +0 -413
- package/src/features/audio-generation/domain/entities.ts +0 -39
- package/src/features/audio-generation/index.ts +0 -1
- package/src/features/colorization/README.md +0 -393
- package/src/features/colorization/domain/entities.ts +0 -46
- package/src/features/colorization/index.ts +0 -1
- package/src/features/future-prediction/README.md +0 -451
- package/src/features/future-prediction/domain/entities.ts +0 -45
- package/src/features/future-prediction/index.ts +0 -1
- package/src/features/image-captioning/README.md +0 -421
- package/src/features/image-captioning/domain/entities.ts +0 -47
- package/src/features/image-captioning/index.ts +0 -1
- package/src/features/inpainting/README.md +0 -406
- package/src/features/inpainting/domain/entities.ts +0 -58
- package/src/features/inpainting/index.ts +0 -1
- package/src/features/sketch-to-image/README.md +0 -393
- package/src/features/sketch-to-image/domain/entities.ts +0 -47
- package/src/features/sketch-to-image/index.ts +0 -1
- package/src/features/style-transfer/README.md +0 -400
- package/src/features/style-transfer/domain/entities.ts +0 -52
- package/src/features/style-transfer/index.ts +0 -1
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
# Colorization Feature
|
|
2
|
-
|
|
3
|
-
Add color to black and white photos using AI.
|
|
4
|
-
|
|
5
|
-
## 📍 Import Path
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { useColorizationFeature } from '@umituz/react-native-ai-generation-content';
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
**Location**: `src/features/colorization/`
|
|
12
|
-
|
|
13
|
-
## 🎯 Feature Purpose
|
|
14
|
-
|
|
15
|
-
Automatically add realistic color to black and white photos using AI. Supports multiple colorization styles including vintage for historical accuracy, vibrant for rich colors, natural for subtle tones, and auto for intelligent detection.
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 📋 Usage Strategy
|
|
20
|
-
|
|
21
|
-
### When to Use This Feature
|
|
22
|
-
|
|
23
|
-
✅ **Use Cases:**
|
|
24
|
-
- Colorizing old family photographs
|
|
25
|
-
- Adding color to historical images
|
|
26
|
-
- Creating artistic colorized versions
|
|
27
|
-
- Restoring faded color photos
|
|
28
|
-
- Creative visual effects
|
|
29
|
-
|
|
30
|
-
❌ **When NOT to Use:**
|
|
31
|
-
- Photo restoration with damage (use Photo Restoration)
|
|
32
|
-
- Image enhancement without colorization (use HD Touch Up)
|
|
33
|
-
- Color correction of existing color photos (use image editing software)
|
|
34
|
-
- Adding artistic filters (use Style Transfer)
|
|
35
|
-
|
|
36
|
-
### Implementation Strategy
|
|
37
|
-
|
|
38
|
-
1. **Select black & white photo** to colorize
|
|
39
|
-
2. **Choose colorization type** (auto, vintage, vibrant, natural)
|
|
40
|
-
3. **Adjust saturation level** (0.5 to 1.5)
|
|
41
|
-
4. **Generate colorized version** with progress tracking
|
|
42
|
-
5. **Preview and compare** with original
|
|
43
|
-
6. **Save or share** result
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## ⚠️ Critical Rules (MUST FOLLOW)
|
|
48
|
-
|
|
49
|
-
### 1. Image Requirements
|
|
50
|
-
- **MUST** provide ONE black & white photo
|
|
51
|
-
- **MUST** use high-quality scans or photos (min 512x512)
|
|
52
|
-
- **MUST** have clear, recognizable content
|
|
53
|
-
- **MUST NOT** exceed file size limits (10MB max)
|
|
54
|
-
- **MUST** be actual B&W or desaturated photos
|
|
55
|
-
|
|
56
|
-
### 2. Configuration
|
|
57
|
-
- **MUST** provide valid `userId` for tracking
|
|
58
|
-
- **MUST** specify `colorizationType` (auto, vintage, vibrant, natural)
|
|
59
|
-
- **MUST** set `saturation` level (0.5 to 1.5)
|
|
60
|
-
- **MUST** implement `onError` callback
|
|
61
|
-
- **MUST** implement `onSelectPhoto` callback
|
|
62
|
-
|
|
63
|
-
### 3. State Management
|
|
64
|
-
- **MUST** check `isReady` before enabling colorize button
|
|
65
|
-
- **MUST** display progress during colorization
|
|
66
|
-
- **MUST** handle long processing times
|
|
67
|
-
- **MUST** display `error` state with clear messages
|
|
68
|
-
- **MUST** implement proper cleanup on unmount
|
|
69
|
-
|
|
70
|
-
### 4. Performance
|
|
71
|
-
- **MUST** implement image compression before upload
|
|
72
|
-
- **MUST** show progress indicator for processing
|
|
73
|
-
- **MUST** cache results locally
|
|
74
|
-
- **MUST** allow users to cancel processing
|
|
75
|
-
- **MUST NOT** colorize multiple photos simultaneously
|
|
76
|
-
|
|
77
|
-
### 5. Content Quality
|
|
78
|
-
- **MUST** provide before/after comparison
|
|
79
|
-
- **MUST** allow saturation adjustment
|
|
80
|
-
- **MUST** handle various photo types
|
|
81
|
-
- **MUST** preserve photo texture when enabled
|
|
82
|
-
- **MUST** offer regeneration with different settings
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## 🚫 Prohibitions (MUST AVOID)
|
|
87
|
-
|
|
88
|
-
### Strictly Forbidden
|
|
89
|
-
|
|
90
|
-
❌ **NEVER** do the following:
|
|
91
|
-
|
|
92
|
-
1. **No Color Images**
|
|
93
|
-
- Always validate input is B&W or desaturated
|
|
94
|
-
- Never attempt to colorize already color photos
|
|
95
|
-
|
|
96
|
-
2. **No Auto-Processing**
|
|
97
|
-
- Never start colorization without user action
|
|
98
|
-
- Always require explicit "Colorize" button press
|
|
99
|
-
- Show preview before processing
|
|
100
|
-
|
|
101
|
-
3. **No Hardcoded Credentials**
|
|
102
|
-
- Never store API keys in component files
|
|
103
|
-
- Use environment variables or secure storage
|
|
104
|
-
|
|
105
|
-
4. **No Unhandled Errors**
|
|
106
|
-
- Never ignore colorization failures
|
|
107
|
-
- Always explain what went wrong
|
|
108
|
-
- Provide retry or alternative options
|
|
109
|
-
|
|
110
|
-
5. **No Memory Leaks**
|
|
111
|
-
- Never store both original and colorized simultaneously
|
|
112
|
-
- Clean up temporary images
|
|
113
|
-
- Implement proper image disposal
|
|
114
|
-
|
|
115
|
-
6. **No Blocked UI**
|
|
116
|
-
- Never block main thread with image processing
|
|
117
|
-
- Always show progress indicator
|
|
118
|
-
- Allow cancellation
|
|
119
|
-
|
|
120
|
-
7. **No Historical Inaccuracy**
|
|
121
|
-
- Never claim colorized versions are historically accurate
|
|
122
|
-
- Provide disclaimer about AI interpretation
|
|
123
|
-
- Allow manual color adjustments for accuracy
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## 🤖 AI Agent Directions
|
|
128
|
-
|
|
129
|
-
### For AI Code Generation Tools
|
|
130
|
-
|
|
131
|
-
When using this feature with AI code generation tools, follow these guidelines:
|
|
132
|
-
|
|
133
|
-
#### Prompt Template for AI Agents
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
You are implementing a colorization feature using @umituz/react-native-ai-generation-content.
|
|
137
|
-
|
|
138
|
-
REQUIREMENTS:
|
|
139
|
-
1. Import from: @umituz/react-native-ai-generation-content
|
|
140
|
-
2. Use the useColorizationFeature hook
|
|
141
|
-
3. Select colorization type (auto, vintage, vibrant, natural)
|
|
142
|
-
4. Implement photo selection UI
|
|
143
|
-
5. Adjust saturation level (0.5 to 1.5)
|
|
144
|
-
6. Validate photo is black & white
|
|
145
|
-
7. Show before/after comparison
|
|
146
|
-
8. Handle long processing times with progress
|
|
147
|
-
9. Implement proper error handling
|
|
148
|
-
10. Implement cleanup on unmount
|
|
149
|
-
|
|
150
|
-
CRITICAL RULES:
|
|
151
|
-
- MUST validate photo is black & white before colorizing
|
|
152
|
-
- MUST show before/after comparison
|
|
153
|
-
- MUST handle saturation adjustment
|
|
154
|
-
- MUST preserve photo texture when enabled
|
|
155
|
-
- MUST implement debouncing (300ms)
|
|
156
|
-
- MUST allow colorization regeneration
|
|
157
|
-
|
|
158
|
-
CONFIGURATION:
|
|
159
|
-
- Provide valid userId (string)
|
|
160
|
-
- Set colorizationType: 'auto' | 'vintage' | 'vibrant' | 'natural'
|
|
161
|
-
- Set saturation: 0.5 to 1.5 (default: 1.0)
|
|
162
|
-
- Set preserveTexture: boolean (maintain photo texture)
|
|
163
|
-
- Implement onSelectPhoto callback
|
|
164
|
-
- Implement onSaveResult callback
|
|
165
|
-
- Configure callbacks: onProcessingStart, onProcessingComplete, onError
|
|
166
|
-
|
|
167
|
-
COLORIZATION TYPES:
|
|
168
|
-
- auto: Automatic color detection and application
|
|
169
|
-
- vintage: Historically accurate vintage tones
|
|
170
|
-
- vibrant: Rich, saturated colors
|
|
171
|
-
- natural: Subtle, natural-looking colors
|
|
172
|
-
|
|
173
|
-
OPTIONS:
|
|
174
|
-
- saturation: Color intensity (0.5 muted to 1.5 vibrant)
|
|
175
|
-
- preserveTexture: Maintain photo texture (default: true)
|
|
176
|
-
|
|
177
|
-
STRICTLY FORBIDDEN:
|
|
178
|
-
- No color photo validation
|
|
179
|
-
- No auto-processing without user action
|
|
180
|
-
- No hardcoded API keys
|
|
181
|
-
- No unhandled errors
|
|
182
|
-
- No memory leaks
|
|
183
|
-
- No blocking UI
|
|
184
|
-
- No historical accuracy claims
|
|
185
|
-
|
|
186
|
-
QUALITY CHECKLIST:
|
|
187
|
-
- [ ] Photo selection implemented
|
|
188
|
-
- [ ] B&W photo validation added
|
|
189
|
-
- [ ] Colorization type selector included
|
|
190
|
-
- [ ] Saturation slider included
|
|
191
|
-
- [ ] Before/after comparison view
|
|
192
|
-
- [ ] Progress indicator during processing
|
|
193
|
-
- [ ] Error display with retry option
|
|
194
|
-
- [ ] Download/share functionality
|
|
195
|
-
- [ ] Regeneration with different settings
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
#### AI Implementation Checklist
|
|
199
|
-
|
|
200
|
-
Use this checklist when generating code:
|
|
201
|
-
|
|
202
|
-
- [ ] Feature imported from correct path
|
|
203
|
-
- [ ] Photo selection implemented
|
|
204
|
-
- [ ] B&W validation added
|
|
205
|
-
- [ ] Colorization type selector added
|
|
206
|
-
- [ ] Saturation control implemented
|
|
207
|
-
- [ ] Validation before colorize()
|
|
208
|
-
- [ ] Before/after comparison view
|
|
209
|
-
- [ ] Progress indicator during processing
|
|
210
|
-
- [ ] Error display with user-friendly message
|
|
211
|
-
- [ ] Download/share buttons
|
|
212
|
-
- [ ] Regeneration option
|
|
213
|
-
- [ ] Cleanup on unmount
|
|
214
|
-
- [ ] Original photo preserved
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
## 🛠️ Configuration Strategy
|
|
219
|
-
|
|
220
|
-
### Essential Configuration
|
|
221
|
-
|
|
222
|
-
```typescript
|
|
223
|
-
// Required fields
|
|
224
|
-
{
|
|
225
|
-
userId: string
|
|
226
|
-
colorizationType: 'auto' | 'vintage' | 'vibrant' | 'natural'
|
|
227
|
-
saturation: number // 0.5 to 1.5
|
|
228
|
-
onSelectPhoto: () => Promise<string | null>
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Optional callbacks
|
|
232
|
-
{
|
|
233
|
-
onProcessingStart?: () => void
|
|
234
|
-
onProcessingComplete?: (result) => void
|
|
235
|
-
onError?: (error: string) => void
|
|
236
|
-
}
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### Recommended Settings
|
|
240
|
-
|
|
241
|
-
1. **Colorization Types**
|
|
242
|
-
- Auto: Automatic color detection (recommended for most photos)
|
|
243
|
-
- Vintage: Historical accuracy for old photos
|
|
244
|
-
- Vibrant: Rich, saturated colors for artistic effect
|
|
245
|
-
- Natural: Subtle, natural-looking colors
|
|
246
|
-
|
|
247
|
-
2. **Saturation Levels**
|
|
248
|
-
- 0.5-0.7: Muted colors (historical feel)
|
|
249
|
-
- 0.8-1.0: Natural colors (recommended)
|
|
250
|
-
- 1.1-1.5: Vibrant colors (artistic effect)
|
|
251
|
-
|
|
252
|
-
3. **Image Quality**
|
|
253
|
-
- Minimum: 512x512 resolution
|
|
254
|
-
- Recommended: 1024x1024 or higher
|
|
255
|
-
- Format: JPEG or PNG
|
|
256
|
-
- Max size: 10MB
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
## 📊 State Management
|
|
261
|
-
|
|
262
|
-
### Feature States
|
|
263
|
-
|
|
264
|
-
**isReady**: boolean
|
|
265
|
-
- Photo selected and validated as B&W
|
|
266
|
-
- Check before enabling colorize button
|
|
267
|
-
|
|
268
|
-
**isProcessing**: boolean
|
|
269
|
-
- Colorization in progress
|
|
270
|
-
- Show loading/progress indicator
|
|
271
|
-
- Disable colorize button
|
|
272
|
-
|
|
273
|
-
**progress**: number (0-100)
|
|
274
|
-
- Colorization progress percentage
|
|
275
|
-
- Update progress bar
|
|
276
|
-
|
|
277
|
-
**error**: string | null
|
|
278
|
-
- Error message if colorization failed
|
|
279
|
-
- Display to user with clear message
|
|
280
|
-
|
|
281
|
-
**result**: {
|
|
282
|
-
imageUrl: string
|
|
283
|
-
originalImageUrl?: string
|
|
284
|
-
colorizationType?: string
|
|
285
|
-
saturation?: number
|
|
286
|
-
metadata?: any
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
---
|
|
290
|
-
|
|
291
|
-
## 🎨 Best Practices
|
|
292
|
-
|
|
293
|
-
### Photo Selection
|
|
294
|
-
|
|
295
|
-
1. **Photo Quality**
|
|
296
|
-
- Good: High-quality scans, clear content
|
|
297
|
-
- Bad: Blurry, low-resolution scans
|
|
298
|
-
|
|
299
|
-
2. **Type Selection**
|
|
300
|
-
- Use Vintage for historical photos
|
|
301
|
-
- Use Vibrant for artistic effect
|
|
302
|
-
- Use Natural for subtle enhancement
|
|
303
|
-
- Use Auto for general use
|
|
304
|
-
|
|
305
|
-
3. **Saturation**
|
|
306
|
-
- Start with 1.0 for natural look
|
|
307
|
-
- Lower for vintage/historical feel
|
|
308
|
-
- Higher for vibrant colors
|
|
309
|
-
|
|
310
|
-
### User Experience
|
|
311
|
-
|
|
312
|
-
1. **Preview**
|
|
313
|
-
- Show B&W preview before colorizing
|
|
314
|
-
- Compare different colorization types
|
|
315
|
-
- Allow saturation adjustment
|
|
316
|
-
|
|
317
|
-
2. **Before/After Comparison**
|
|
318
|
-
- Side-by-side comparison
|
|
319
|
-
- Slider for easy comparison
|
|
320
|
-
- Zoom for detail inspection
|
|
321
|
-
|
|
322
|
-
---
|
|
323
|
-
|
|
324
|
-
## 🐛 Common Pitfalls
|
|
325
|
-
|
|
326
|
-
### Validation Issues
|
|
327
|
-
|
|
328
|
-
❌ **Problem**: Attempting to colorize color photos
|
|
329
|
-
✅ **Solution**: Validate photo is B&W before processing
|
|
330
|
-
|
|
331
|
-
### Quality Issues
|
|
332
|
-
|
|
333
|
-
❌ **Problem**: Poor colorization results
|
|
334
|
-
✅ **Solution**: Use higher quality scan, try different type
|
|
335
|
-
|
|
336
|
-
### Historical Accuracy
|
|
337
|
-
|
|
338
|
-
❌ **Problem**: Colors don't match historical reality
|
|
339
|
-
✅ **Solution**: Use vintage type, provide manual adjustment option
|
|
340
|
-
|
|
341
|
-
---
|
|
342
|
-
|
|
343
|
-
## 📦 Related Components
|
|
344
|
-
|
|
345
|
-
Use these components from the library:
|
|
346
|
-
|
|
347
|
-
- **PhotoUploadCard**: Upload photo interface
|
|
348
|
-
- **ColorizationTypeSelector**: Choose colorization style
|
|
349
|
-
- **SaturationSlider**: Adjust color intensity
|
|
350
|
-
- **ResultDisplay**: Before/after comparison
|
|
351
|
-
- **ProgressBar**: Progress display
|
|
352
|
-
|
|
353
|
-
Located at: `src/presentation/components/`
|
|
354
|
-
|
|
355
|
-
---
|
|
356
|
-
|
|
357
|
-
## 🔄 Migration Strategy
|
|
358
|
-
|
|
359
|
-
If migrating from previous implementation:
|
|
360
|
-
|
|
361
|
-
1. **Update imports** to new path
|
|
362
|
-
2. **Add B&W photo validation**
|
|
363
|
-
3. **Implement colorization type selector**
|
|
364
|
-
4. **Update state handling** for new structure
|
|
365
|
-
5. **Add before/after comparison**
|
|
366
|
-
6. **Test all colorization types**
|
|
367
|
-
|
|
368
|
-
---
|
|
369
|
-
|
|
370
|
-
## 📚 Additional Resources
|
|
371
|
-
|
|
372
|
-
- Main documentation: `/docs/`
|
|
373
|
-
- API reference: `/docs/api/`
|
|
374
|
-
- Examples: `/docs/examples/basic/colorization/`
|
|
375
|
-
- Architecture: `/ARCHITECTURE.md`
|
|
376
|
-
|
|
377
|
-
---
|
|
378
|
-
|
|
379
|
-
**Last Updated**: 2025-01-08
|
|
380
|
-
**Version**: 2.0.0 (Strategy-based Documentation)
|
|
381
|
-
|
|
382
|
-
---
|
|
383
|
-
|
|
384
|
-
## 📝 Changelog
|
|
385
|
-
|
|
386
|
-
### v2.0.0 - 2025-01-08
|
|
387
|
-
- **BREAKING**: Documentation format changed to strategy-based
|
|
388
|
-
- Removed extensive code examples
|
|
389
|
-
- Added rules, prohibitions, and AI agent directions
|
|
390
|
-
- Focus on best practices and implementation guidance
|
|
391
|
-
|
|
392
|
-
### v1.0.0 - Initial Release
|
|
393
|
-
- Initial feature documentation
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Colorization Domain Entities
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface ColorizationConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Guidance for color palette (e.g., "vintage", "modern", "warm")
|
|
8
|
-
*/
|
|
9
|
-
palette?: string;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Saturation boost factor
|
|
13
|
-
* @default 1.0
|
|
14
|
-
*/
|
|
15
|
-
saturation?: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ColorizationRequest {
|
|
19
|
-
/**
|
|
20
|
-
* The black and white image to colorize.
|
|
21
|
-
* Can be a Base64 string or a remote URL.
|
|
22
|
-
*/
|
|
23
|
-
image: string;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Optional prompt to guide colorization (e.g. "sunny day")
|
|
27
|
-
*/
|
|
28
|
-
prompt?: string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Optional configuration
|
|
32
|
-
*/
|
|
33
|
-
options?: ColorizationConfig;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface ColorizationResult {
|
|
37
|
-
/**
|
|
38
|
-
* The colorized image URL or Base64
|
|
39
|
-
*/
|
|
40
|
-
imageUrl: string;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Metadata about the generation
|
|
44
|
-
*/
|
|
45
|
-
metadata?: Record<string, unknown>;
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './domain/entities';
|