Skip to content

anbeime/skill / skills/video-creation-suite/video-creation-suite

video-creation-suite

Unverified

自媒体创作者与影片与视频编辑当需要从零原创、二次创作或深度分析视频时,请使用此套件。通过11个智能体协同,一键生成配音、音效与BGM并合成高质量视频,或自动抽帧提取分镜提示词,全流程大幅提升视频产出效率。

scripts/image_generator.py

View on GitHub
#!/usr/bin/env python3
"""
图像生成脚本
为视频创作生成关键帧图片和背景图像
"""

import os
from typing import Dict, Any
from .error_handler import retry_on_failure, ErrorLogger, safe_execute

logger = ErrorLogger()

@retry_on_failure(max_retries=2, retry_delay=0.5)
def generate_image_from_prompt(
    prompt: str,
    output_path: str,
    image_size: str = "1024x1024",
    style: str = "realistic",
    seed: int = None
) -> Dict[str, Any]:
    """
    根据提示词生成图像(占位实现)

    参数:
        prompt: 图像生成提示词
        output_path: 输出图像路径
        image_size: 图像尺寸(1024x1024, 768x1344, 832x1216等)
        style: 图像风格(realistic, cartoon, artistic等)
        seed: 随机种子(可选)

    返回:
        包含生成结果的字典
    """
    # 验证输出目录
    os.makedirs(os.path.dirname(output_path), exist_ok=True)

    # 占位实现 - 实际应调用图像生成API
    # 这里创建一个纯色占位图
    from PIL import Image, ImageDraw

    width, height = map(int, image_size.split('x'))
    image = Image.new('RGB', (width, height), color='lightgray')
    draw = ImageDraw.Draw(image)

    # 添加提示词文本
    draw.text((10, 10), prompt[:100], fill='black')

    image.save(output_path)

    logger.log_info(f"图像已生成(占位): {output_path}")

    return {
        "success": True,
        "output_path": output_path,
        "prompt": prompt,
        "image_size": image_size,
        "style": style
    }


def batch_generate_images(
    prompts: list,
    output_dir: str,
    naming_pattern: str = "frame_{:04d}.png"
) -> list:
    """
    批量生成图像

    参数:
        prompts: 提示词列表
        output_dir: 输出目录
        naming_pattern: 文件命名模式

    返回:
        生成结果列表
    """
    os.makedirs(output_dir, exist_ok=True)

    results = []
    for i, prompt in enumerate(prompts):
        output_path = os.path.join(output_dir, naming_pattern.format(i))

        result = generate_image_from_prompt(
            prompt=prompt,
            output_path=output_path
        )

        results.append(result)

        logger.log_info(f"进度: {i+1}/{len(prompts)}")

    return results


if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(description="图像生成工具")
    parser.add_argument("--prompt", required=True, help="图像生成提示词")
    parser.add_argument("--output", required=True, help="输出图像路径")
    parser.add_argument("--size", default="1024x1024", help="图像尺寸")
    parser.add_argument("--style", default="realistic", help="图像风格")

    args = parser.parse_args()

    result = generate_image_from_prompt(
        prompt=args.prompt,
        output_path=args.output,
        image_size=args.size,
        style=args.style
    )

    if result["success"]:
        print(f"✓ 图像生成成功: {result['output_path']}")
    else:
        print(f"✗ 图像生成失败")
        exit(1)
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall