how to save png directly from python script?
See original GitHub issueI note that when I do an Altair visualization (example.html), there’s an “export PNG” button beneath it. Can I call this straight from python? I’d like to be able to:
open('example.html', 'w').write(chart.to_html())
open('example.png', 'w').write(chart.to_png())
but that does not appear to be possible, and I can’t obviously see how to export png from python directly.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Loading and Saving Images in Python | by Renu Khandelwal
You can save the JPEG image in a different format like PNG using save() of the PIL img_PIL.save(r'\dogs-v-cats\dog.1.png') ...
Read more >Save plot to image file instead of displaying it using Matplotlib
When using matplotlib.pyplot.savefig , the file format can be specified by the extension: from matplotlib import pyplot as plt plt.savefig('foo.png') ...
Read more >How to download an image with Python? - ScrapingBee
This tutorial will show you how to download and save images with Python from URL. There are different librairies that can help you...
Read more >Python script to convert scripts to png files
I have written a Python script that converts scripts to png files, entirely by myself without anybody's help.
Read more >Convert Image To PNG Python - Aspose
1. Install 'Aspose.Words for Python via .NET'. 2. Add a library reference (import the library) to your Python project. 3. Open the source...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there three years later maybe a native way to save altair/vega figures to png/jpeg/svg without a headless browser?
Many thanks for your great work
A possible approach is to save charts without a headless browser is to use Kaleido; tracking issue is here: https://github.com/altair-viz/altair_saver/issues/85
The main challenge is finding someone who wants to put in the time to try it!