图片转PPT - 在线多图合并生成幻灯片工具
是什么:图片转PPT是一款免费的在线工具,可以将多张图片按顺序合并生成 PowerPoint 演示文稿(.pptx),每页幻灯片自动放置一张图片并居中适配。
为什么:无需安装任何软件,浏览器内即可完成图片到PPT的转换。适用于照片整理、产品展示、课件制作、相册汇总等场景。
使用说明
- 上传图片:点击上传按钮或拖拽图片到虚线区域,支持同时选择多张图片。
- 调整顺序:上传完成后进入排序页面,拖拽缩略图即可调整PPT页码顺序。
- 生成下载:点击"生成PPT"按钮,等待处理完成后即可下载 .pptx 文件。
Python 示例
使用 python-pptx 将图片批量转为PPT
from pptx import Presentation
from pptx.util import Inches
import os
def images_to_ppt(image_paths, output_path):
"""将多张图片按顺序生成PPT"""
prs = Presentation()
prs.slide_width = Inches(13.333) # 16:9 宽屏
prs.slide_height = Inches(7.5)
blank_layout = prs.slide_layouts[6]
slide_w = prs.slide_width
slide_h = prs.slide_height
margin = Inches(0.3)
for img_path in image_paths:
slide = prs.slides.add_slide(blank_layout)
# 计算图片适配尺寸
from PIL import Image as PILImage
with PILImage.open(img_path) as img:
img_w, img_h = img.size
img_w_in = Inches(img_w / 96.0)
img_h_in = Inches(img_h / 96.0)
max_w = slide_w - 2 * margin
max_h = slide_h - 2 * margin
scale = min(max_w / img_w_in, max_h / img_h_in, 1.0)
final_w = img_w_in * scale
final_h = img_h_in * scale
left = (slide_w - final_w) / 2
top = (slide_h - final_h) / 2
slide.shapes.add_picture(img_path, left, top, final_w, final_h)
prs.save(output_path)
print(f"PPT已保存: {output_path}")
# 使用示例
images_to_ppt(["1.jpg", "2.png", "3.jpg"], "output.pptx")
安装依赖
pip install python-pptx Pillow
一句话总结:图片转PPT工具让照片快速变为演示文稿,无需安装Office,浏览器内即可完成,支持拖拽排序,是整理图片素材的便捷利器。