Merge branch 'reinstruct' of http://8.134.70.224:8300/jinye_huang/TravelContentCreator into reinstruct
This commit is contained in:
commit
15f6418f42
Binary file not shown.
@ -214,6 +214,11 @@ class PosterService:
|
|||||||
|
|
||||||
|
|
||||||
# # 3. 图片解码
|
# # 3. 图片解码
|
||||||
|
images = None
|
||||||
|
# 获取模板的默认尺寸,如果获取不到则使用标准尺寸
|
||||||
|
template_size = getattr(template_handler, 'size', (900, 1200))
|
||||||
|
|
||||||
|
if images_base64 and images_base64.strip():
|
||||||
try:
|
try:
|
||||||
# 移除可能存在的MIME类型前缀
|
# 移除可能存在的MIME类型前缀
|
||||||
if images_base64.startswith("data:"):
|
if images_base64.startswith("data:"):
|
||||||
@ -224,9 +229,18 @@ class PosterService:
|
|||||||
|
|
||||||
# 创建PIL Image对象
|
# 创建PIL Image对象
|
||||||
images = Image.open(BytesIO(image_bytes))
|
images = Image.open(BytesIO(image_bytes))
|
||||||
|
logger.info("图片解码成功")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"解码失败: {e}")
|
logger.error(f"图片解码失败: {e}")
|
||||||
|
# 创建一个与目标大小一致的纯黑底图
|
||||||
|
images = Image.new('RGB', template_size, color='black')
|
||||||
|
logger.info(f"创建默认黑色背景图,尺寸: {template_size}")
|
||||||
|
else:
|
||||||
|
logger.warning("未提供图片数据,使用默认黑色背景图")
|
||||||
|
# 创建一个与目标大小一致的纯黑底图
|
||||||
|
images = Image.new('RGB', template_size, color='black')
|
||||||
|
logger.info(f"创建默认黑色背景图,尺寸: {template_size}")
|
||||||
|
|
||||||
# 4. 调用模板生成海报
|
# 4. 调用模板生成海报
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user