大家好,我是专注AI潮汕IP设计的小江。
最近很多烘焙店和奶茶店老板问我,如何用AI低成本生成一套既有潮汕特色,又能直接商用的国潮甜品IP?
今天分享一套我最近设计的"带炸英歌"系列。这套设计以"酷猫+英歌舞"为核心IP,寓意"一口带炸,好运到"。
很多设计师用AI画图最大的痛点是"抽卡",角色长得不一样,风格不统一。为了解决这个问题,我编写了Python脚本结合SDXL模型,实现了对IP形象的精准控制。
import torch
from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler
1. 初始化SDXL模型加载器
def load_sdxl_model(model_path):
pipe = StableDiffusionXLPipeline.from_pretrained(
model_path,
torch_dtype=torch.float16,
use_safetensors=True,
variant="fp16"
)
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
return pipe.to("cuda")
2. 定义"带炸英歌"IP的专属Prompt模板
这里的关键词是经过几百次测试筛选出来的,能保证生成"酷猫"和"英歌舞"元素的稳定融合
PROMPT_TEMPLATE = """
(masterpiece, best quality), 3d render, c4d style, blind box toy style,
cool cat character wearing chaozhou yingge dance costume, sunglasses, holding flags,
standing on a festive birthday cake / holding a paper bag,
red and gold color scheme, chinese new year elements, "Fu" character decoration,
coconut trees background, bright lighting, commercial product photography,
--ar 3:4
"""
3. 批量生成并自动保存
def generate_ip_batch(pipe, count=5):
for i in range(count):
image = pipe(
prompt=PROMPT_TEMPLATE,
negative_prompt="ugly, deformed, noisy, blurry, distorted, text error", # 负面提示词很重要
guidance_scale=7.5,
num_inference_steps=30
).images0
自动命名保存,方便后续整理交付给客户
save_path = f"./output/chaoshan_ip_{i+1}.png"
image.save(save_path)
print(f"成功生成: {save_path}")
if name == "main":
实际运行时调用
model = load_sdxl_model("your_model_path")
generate_ip_batch(model)
pass

