Read the complete article on how to convert text to PNG, JPEG, and GIF images in Python: https://blog.aspose.com/2022/05/01/convert-text-to-image-in-python/
Last active
June 7, 2022 06:57
-
-
Save aspose-com-gists/025467f65c906a8ad378e91d08f51428 to your computer and use it in GitHub Desktop.
Convert Text to PNG, JPEG, and GIF Image 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.words as aw | |
# Load the Word document | |
doc = aw.Document("document.txt") | |
# Loop through each page | |
for page in range(doc.page_count): | |
# Extract the page | |
extractedPage = doc.extract_pages(page, 1) | |
# Save as image, e.g. PNG | |
extractedPage.save("Output_" + str(page + 1) + ".png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment