mcpField
P
photo-colorization

photo-colorization

github.com/eachlabs创意与媒体44227 次安装今天更新
代码仓库

关于 photo-colorization

photo-colorization 使用 each::sense 将黑白照片转换为彩色图像,适用于照片修复和档案工作。它可根据图像内容及年代背景生成配色,并保留原有细节。

主要功能

  1. 01AI 照片上色
  2. 02结合年代背景的配色
  3. 03人像与风景自然着色
  4. 04保留原始图像细节
  5. 05按序批量处理

适用场景

  1. 01修复家庭肖像和快照
  2. 02为历史档案照片上色
  3. 03为风景和建筑照片上色

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/eachlabs/skills --skill photo-colorization

安装后在 Claude Code 中输入/photo-colorization确认已加载。

附带文件references/SSE-EVENTS.md

详细介绍

照片上色

使用 each::sense 将黑白照片转换为鲜艳、逼真的彩色图像。这项技能会利用 AI 智能分析图像内容,并应用符合历史背景和具体情境的色彩。

功能

  • 自动上色:AI 检测主体并应用自然色彩
  • 历史准确性:根据情境调整色彩,呈现符合时代背景的效果
  • 人像增强:为面部和人像呈现逼真的肤色
  • 风景修复:为户外和自然场景还原自然色彩
  • 复苏老照片:让老旧家庭照片重焕生机
  • 批量处理:按顺序为多张照片上色
  • 保留原有风格:保留原始照片的质量和细节

快速开始

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this black and white photo with natural, realistic colors"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/bw-photo.jpg"],
    "mode": "max"
  }'

常见用例

用例描述适用场景
家庭档案为老家庭肖像和抓拍照片上色个人修复
历史文献为档案照片进行符合时代背景的上色博物馆、历史学家
人像增强呈现逼真的肤色和面部特征专业修复
风景复原为户外和风景照片还原自然色彩自然摄影
复古时尚准确还原服装和面料的色彩时尚档案
军事/战争照片修复历史军事照片纪念项目
建筑为建筑和室内照片上色房地产、遗产保护

用例示例

1. 自动上色

使用 AI 检测到的色彩进行基础上色。

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this black and white photograph. Apply natural, realistic colors based on the image content. Maintain the original quality and details."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/old-photo.jpg"],
    "mode": "max"
  }'
2. 历史照片上色

按照符合时代背景的历史准确性进行上色。

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this historical photograph from the 1940s. Use period-accurate colors typical of that era - muted tones, authentic clothing colors, and historically appropriate details. This appears to be a street scene."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/1940s-street.jpg"],
    "mode": "max"
  }'
3. 家庭肖像上色

用温暖、自然的色调让老家庭照片重焕生机。

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this old family portrait photo. Apply natural skin tones, realistic hair colors, and period-appropriate clothing colors. The photo appears to be from the 1950s-1960s era. Make it look warm and inviting."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/family-portrait-bw.jpg"],
    "mode": "max"
  }'
4. 风景上色

为户外和风景照片还原自然色彩。

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this black and white landscape photograph. Apply natural colors - blue sky, green foliage, brown earth tones. Make it look like a vibrant summer day while preserving the original composition and atmosphere."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/landscape-bw.jpg"],
    "mode": "max"
  }'
5. 指定肤色的人像

控制肤色上色效果,以获得准确结果。

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this portrait photograph. The subject has a medium olive skin tone and dark brown hair. Apply natural, warm skin colors with subtle pink undertones. Eyes appear to be brown. Clothing looks like a dark formal suit."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/portrait-bw.jpg"],
    "mode": "max"
  }'
6. 复古照片上色

根据特定年代的风格修复老照片。

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this vintage photograph from the 1920s. Apply colors that match the Art Deco era - rich jewel tones for clothing, sepia-influenced skin tones, and period-appropriate interior colors. Maintain the vintage aesthetic while adding realistic color."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/1920s-vintage.jpg"],
    "mode": "max"
  }'
7. 战争/军事照片上色

准确修复历史军事照片。

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this World War II military photograph. Apply historically accurate colors - olive drab for US Army uniforms, appropriate skin tones for the soldiers, realistic equipment colors. Maintain the somber, documentary feel of the original while adding authentic military colors."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/wwii-soldiers.jpg"],
    "mode": "max"
  }'
8. 建筑上色

为建筑和室内照片上色。

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this black and white photograph of a Victorian-era building. Apply appropriate architectural colors - red or brown brick, white trim, dark roof tiles, green copper patina if visible. Include natural sky colors and surrounding landscape elements."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/victorian-building.jpg"],
    "mode": "max"
  }'
9. 时尚/服装上色

准确还原面料和时尚服饰的色彩。

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this 1960s fashion photograph. Apply era-appropriate colors - bold mod colors like orange, turquoise, and pink were popular. The model appears to be wearing a structured dress. Apply realistic fabric textures and vibrant 60s palette."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/1960s-fashion.jpg"],
    "mode": "max"
  }'
10. 为多张照片批量上色

通过保持会话连续性,以一致的风格处理多张照片。

# First photo in batch
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this black and white family photo from the 1950s. Apply warm, natural colors with period-appropriate tones. This is photo 1 of a series from the same family album."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/family-album-001.jpg"],
    "session_id": "family-album-colorization",
    "mode": "max"
  }'

# Second photo (same session for consistency)
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this second photo from the same family album. Maintain consistent skin tones and color style as the previous colorization."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/family-album-002.jpg"],
    "session_id": "family-album-colorization",
    "mode": "max"
  }'

# Third photo (continuing series)
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize the third photo. Same family, same era. Keep the color palette consistent with previous images."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/family-album-003.jpg"],
    "session_id": "family-album-colorization",
    "mode": "max"
  }'

最佳实践

图像质量
  • 分辨率:分辨率越高,照片上色效果越好
  • 对比度:原图对比度良好,有助于 AI 识别细节
  • 清晰度:清晰锐利的照片比模糊的照片更适合上色
  • 照片状况:上色前进行数字修复可以改善效果
提示词技巧
  • 提供背景信息:说明时代、地点或主体
  • 指定肤色:如果已知,请描述主体的肤色
  • 说明服装颜色:如果知道原始颜色,请一并注明
  • 描述场景:户外/室内、季节、一天中的时段
历史准确性
  • 研究相关时代,以选用真实的色彩搭配
  • 考虑时尚和建筑的地域差异
  • 军服和装备都有特定且有据可查的颜色
  • 复古汽车和其他车辆的颜色通常有详细记录

模式选择

模式适用场景速度质量
max最终修复、档案工作、礼物较慢最高
eco快速预览、批量测试、草稿较快良好

建议:先使用 eco 模式进行初步测试,再使用 max 生成最终结果。

多轮优化

使用 session_id 迭代并优化上色效果:

# Initial colorization
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Colorize this old portrait photograph with natural colors"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/portrait.jpg"],
    "session_id": "portrait-restoration"
  }'

# Refine the result
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "The skin tones look a bit too warm. Can you redo the colorization with cooler, more natural skin tones?"}],
    "model": "eachsense/beta",
    "stream": true,
    "session_id": "portrait-restoration"
  }'

# Further adjustment
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "The dress should be blue, not green. Please adjust the clothing color."}],
    "model": "eachsense/beta",
    "stream": true,
    "session_id": "portrait-restoration"
  }'

错误处理

错误原因解决方案
Failed to create prediction: HTTP 422余额不足在 eachlabs.ai 充值
Invalid image URLURL 无法访问确保图片 URL 可公开访问
超时图片过大或场景复杂将客户端超时时间设为至少 10 分钟
上色效果不佳源图质量较低使用分辨率更高、更清晰的源图

相关技能

  • each-sense - 核心 API 文档
  • image-restoration - 通用图像修复
  • image-enhancement - 增强并放大图像
  • face-restoration - 专门的人脸增强

评论

支持 Markdown