Created
October 22, 2020 01:54
-
-
Save aspose-com-gists/ec402be9a402ba91e80a585235f24743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the PowerPoint presentation | |
Presentation pres = new Presentation("presentation.pptx"); | |
// Define dimensions | |
int desiredX = 1200; | |
int desiredY = 800; | |
// Get scaled values of X and Y | |
float ScaleX = (float)(1.0 / pres.getSlideSize().getSize().getWidth()) * desiredX; | |
float ScaleY = (float)(1.0 / pres.getSlideSize().getSize().getHeight()) * desiredY; | |
// Loop through each slide in the presentation | |
for (ISlide sld : pres.getSlides()) { | |
// Create a full scale image | |
BufferedImage bi = sld.getThumbnail(ScaleX, ScaleY); | |
// Create a new file | |
File outputfile = new File(sld.getSlideNumber() + "_Slide.jpg"); | |
// Save the image to disk in JPEG format | |
ImageIO.write(bi, "jpg", outputfile); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the PowerPoint presentation | |
Presentation pres = new Presentation("presentation.pptx"); | |
// Loop through each slide in the presentation | |
for (ISlide sld : pres.getSlides()) { | |
// Create a full scale image | |
BufferedImage bi = sld.getThumbnail(1f, 1f); | |
// Create a new file | |
File outputfile = new File(sld.getSlideNumber() + "_Slide.jpg"); | |
// Save the image to disk in JPEG format | |
ImageIO.write(bi, "jpg", outputfile); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment