0

I was looking at the following python library: Link here

I don't think it has the capability of saving the output as .png or .jpeg.

I surfed on google a lot, Could someone Please give me some pointers on how to do it?

Thanks

Joe

J. Doe
  • 153
  • 1
  • 1
  • 12
  • You can convert the html output to an image. Take a look [here](http://stackoverflow.com/questions/3159367/python-render-html-content-to-gif-image) and [here](http://stackoverflow.com/questions/2192799/html-to-image-in-javascript-or-python) – dot.Py Mar 13 '17 at 13:26
  • You can use a server rendering with the use of phantomjs - see those sections http://www.highcharts.com/docs/export-module/render-charts-serverside http://www.highcharts.com/articles/2-news/56-improved-image-export-with-phantomjs – morganfree Mar 13 '17 at 14:21

1 Answers1

0

No, the highcharts package does not offer that functionality. You could either edit their code, or look into a package that converts html to png. For example https://github.com/AdamN/python-webkit2png

You can call this package from python

import subprocess
subprocess.call("python scripts/webkit2png -h", shell=True)
Roelant
  • 4,508
  • 1
  • 32
  • 62
  • Hi, I don't want to open browser as this will be done in linux machine and I don't have a browser. Plus the screenshot does add the pic but also has additional black block in the end. – J. Doe Mar 13 '17 at 13:33
  • webkit2png does not require a browser. Edited my post. – Roelant Mar 13 '17 at 13:36
  • dumb question, how do I add it in my python script? `import webkit2png webkit2png("path to the html")` – J. Doe Mar 13 '17 at 13:39
  • Its a separate program. See the snippet in my answer :) – Roelant Mar 13 '17 at 13:40
  • [Here is the link of the error](https://snag.gy/fTgCrE.jpg) Tutorial followed: [Tutorial Link](http://www.paulhammond.org/webkit2png/) – J. Doe Mar 13 '17 at 13:43
  • Sorry, was using the standard webkit2png version :) edited my code. Did you install web2kit with pip? – Roelant Mar 13 '17 at 13:46
  • Yes, I installed it using pip, pip install web2kit – J. Doe Mar 13 '17 at 13:49
  • It is not able to find the script, [link](https://snag.gy/g8nvmH.jpg) The reason could be because I installed it via pip? – J. Doe Mar 13 '17 at 14:02