Search code examples
pngpowerpointtransparent

PPT to PNG with transparent background


I have a PowerPoint .ppt file and I have to create an image for every slide.

I'm trying to use the integrated PowerPoint "export as .png". It works but the images have all a opaque background, I need a transparent one.

Anyone knows if is it possible and how to do it? (If not via standard export, also with a macro is fine)


Solution

  • It can't be done, either manually or progamatically. This is because the color behind every slide master is white. If you set your background to 100% transparent, it will print as white.

    The best you could do is design your slide with all the stuff you want, group everything you want to appear in the transparent image and then right-click/save as picture/.PNG (or you could do that with a macro as well). In this way you would retain transparency.

    Here's an example of how to export all slides' shapes to seperate PNG files. Note:

    1. This does not get any background shapes on the Slide Master.
    2. Resulting PNGs will not be the same size as each other, depending on where the shapes are located on each slide.
    3. This uses a depreciated function, namely Shape.Export. This means that while the function is still available up to PowerPoint 2010, it may be removed from PowerPoint VBA later.

      Sub PrintShapesToPng()
          Dim ap As Presentation: Set ap = ActivePresentation
          Dim sl As slide
          Dim shGroup As ShapeRange
          For Each sl In ap.Slides
              ActiveWindow.View.GotoSlide (sl.SlideIndex)
              sl.Shapes.SelectAll
              Set shGroup = ActiveWindow.Selection.ShapeRange
              shGroup.Export ap.Path & "\Slide" & sl.SlideIndex & ".png", _
                                  ppShapeFormatPNG, , , ppRelativeToSlide
          Next
      End Sub