1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How to export pptx to image (png, jpeg) in Python?

Discussão em 'Python' iniciado por Stack, Setembro 14, 2024.

  1. Stack

    Stack Membro Participativo

    I have developed a small code in Python to generate a PPTX file. But I would like also to generate a picture in PNG or JPEG of the slide.

    from pptx import Presentation
    from pptx.util import Inches

    img_path = 'monty-truth.png'

    prs = Presentation()
    blank_slide_layout = prs.slide_layouts[6]
    slide = prs.slides.add_slide(blank_slide_layout)

    left = top = Inches(1)
    pic = slide.shapes.add_picture(img_path, left, top)

    left = Inches(5)
    height = Inches(5.5)
    pic = slide.shapes.add_picture(img_path, left, top, height=height)

    prs.save('test.pptx')


    Is there a way to transform a PPTX file (including just one slide) into a PNG or JPEG picture ?

    Continue reading...

Compartilhe esta Página