diff --git a/assets/copyright-img/稻壳.png b/assets/copyright-img/稻壳.png deleted file mode 100644 index 5280014..0000000 Binary files a/assets/copyright-img/稻壳.png and /dev/null differ diff --git a/py-src/del_copyright_img.py b/py-src/del_copyright_img.py index 88ee906..2cd336a 100644 --- a/py-src/del_copyright_img.py +++ b/py-src/del_copyright_img.py @@ -57,8 +57,10 @@ def remove_copyright_images(pptx_path, copyright_image_paths): change_text = False # 定义要替换的关键字数组 replace_text_keywords = ["第一PPT"] - # 定义要删除的关键字符数组 + # 定义要删除的关键字符数组(只删除文本框) del_text_keywords = ["Speaker name and title", "OfficePLUS", "Presenter name", "www.officeplus.cn", "第一PPT模板网-WWW.1PPT.COM"] + # 定义要删除的关键字符数组(删除整页幻灯片) + del_text_keywords_slide = ["如需商用请您自行向版权方购买、获取商用版权。"] # 遍历每一页幻灯片 for index, slide in enumerate(prs.slides): @@ -87,6 +89,13 @@ def remove_copyright_images(pptx_path, copyright_image_paths): # 检查形状是否为文本框 if shape.has_text_frame: text_content = shape.text + print(f"'{os.path.basename(pptx_path)}'在第 {index + 1} 页有文本框,内容为: '{text_content}'") + + # 检查文本内容是否包含要删除的关键字符数组中的任意字符 + if any(char in text_content for char in del_text_keywords_slide): + print(f"'{os.path.basename(pptx_path)}'在第 {index + 1} 页需要删除,内容为: '{text_content}'") + slides_to_delete.append(index) + break # 检查文本内容是否包含要删除的关键字符数组中的任意字符 if any(char in text_content for char in del_text_keywords):