Learn how to create thumbnails for PPT slides in Python: https://blog.aspose.com/2022/01/28/create-thumbnails-for-ppt-in-python/
Last active
March 18, 2024 20:55
-
-
Save aspose-com-gists/ca731f8fd76b67fc56580bd84d112665 to your computer and use it in GitHub Desktop.
Create Thumbnails for PPT Slides in Python
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
import aspose.slides as slides | |
import aspose.pydrawing as drawing | |
with slides.Presentation("presentation.pptx") as pres: | |
# User defined dimension | |
desiredX = 1200 | |
desiredY = 800 | |
# Get scaled values of X and Y | |
ScaleX = (1.0 / pres.slide_size.size.width) * desiredX | |
ScaleY = (1.0 / pres.slide_size.size.height) * desiredY | |
# Loop through slides | |
for slide in pres.slides: | |
# Create thumbnail | |
bmp = slide.get_thumbnail(ScaleX, ScaleY) | |
# Save the image to disk in JPEG format | |
bmp.save("Thumbnail_{i}.jpg".format(i = slide.slide_number), drawing.imaging.ImageFormat.jpeg) |
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
import aspose.slides as slides | |
import aspose.pydrawing as drawing | |
with slides.Presentation("presentation.pptx") as pres: | |
# Loop through slides | |
for slide in pres.slides: | |
# Create a full scale image | |
bmp = slide.get_thumbnail(1, 1) | |
# Save the image to disk in JPEG format | |
bmp.save("Thumbnail_{i}.jpg".format(i = slide.slide_number), drawing.imaging.ImageFormat.jpeg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
waaaateeer MARK!!!