Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created October 22, 2020 01:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/ec402be9a402ba91e80a585235f24743 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/ec402be9a402ba91e80a585235f24743 to your computer and use it in GitHub Desktop.
// 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);
}
// 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