Convert PNG to PPT in PHP
Place a PNG image on a slide and save the result as a PowerPoint PPT file with Aspose.Slides for PHP via Java.
Convert PNG to PPT in PHP
Aspose.Slides for PHP via Java lets you place a PNG image on a presentation slide at its original dimensions and save the result as a PowerPoint 97–2003 PPT file.
The PNG is stored as an image on the slide, so the presentation remains editable while the original raster image content is preserved.
Convert PNG to PPT using PHP
Create a Presentation, load the PNG with Images::fromFile, match the slide size to the image with setSize, add the image with addPictureFrame, and call save with SaveFormat::Ppt.
PHP code for converting PNG into PPT
$presentation = new Presentation();
try {
$slide = $presentation->getSlides()->get_Item(0);
$sourceImage = Images::fromFile("input.png");
try {
$embeddedImage = $presentation->getImages()->addImage($sourceImage);
} finally {
$sourceImage->dispose();
}
$imageWidth = java_values($embeddedImage->getWidth());
$imageHeight = java_values($embeddedImage->getHeight());
$presentation->getSlideSize()->setSize(
$imageWidth, $imageHeight, SlideSizeScaleType::DoNotScale);
$slide->getShapes()->addPictureFrame(
ShapeType::Rectangle, 0, 0, $imageWidth, $imageHeight, $embeddedImage);
$presentation->save("output.ppt", SaveFormat::Ppt);
} finally {
$presentation->dispose();
}
How to convert PNG to PPT using Aspose.Slides for PHP API
These are the steps to convert PNG to PPT in PHP.
Install Aspose.Slides for PHP via Java .
Create a
Presentation, access its first slide, and load the PNG withImages::fromFile.Set the slide dimensions with
setSize, then place the image on the slide withaddPictureFrame.Call
savewith the output file path andSaveFormat::Ppt.
Free Online Converter
Convert PNG To Other Supported Formats
You can also convert PNG and save to other file formats. See all supported formats below: