Krona icon indicating copy to clipboard operation
Krona copied to clipboard

Automate export of snapshots

Open toddknutson opened this issue 9 years ago • 5 comments

Is there any way to automate (script) the export of snapshot SVG images? Thanks!

toddknutson avatar Jan 05 '16 17:01 toddknutson

Not built into Krona...you would have to use Automator or another macro system to click the snapshot button.

ondovb avatar Jan 07 '16 15:01 ondovb

I tried to convert the HTML to image using PhantomJS, but the output does not render correctly. Here is the command I used: phantomjs rasterize.js krona.out.html krona_snap.png. Any ideas? Is this something that could be built into the program?

stevekm avatar Nov 14 '16 18:11 stevekm

Rasterize.js seems to wait 200ms for the page to load before rendering, but the Krona chart is still in its opening animation at this point. It should work if you change that (at line 46) to 850, which is the current animation length.

ondovb avatar Nov 14 '16 20:11 ondovb

Thanks, this worked perfectly, it also helped a lot to change the page.viewportSize = { width: 1000, height: 1000 }; at line 15 in the rasterize.js script

stevekm avatar Nov 16 '16 16:11 stevekm

Has anyone been able to generate screenshots using a krona.html file with percent-encoding? This would be helpful, because it could potentially allow you to automate the screenshot of an Krona pie chart, at a specific level (i.e. the bacteria level, instead of the root level) if you know the "node" of interest (because it's embedded in the URL). To find this "percent-encoded" URL, I clicked the "link" button (next to snapshot button) on the Krona HTML page to get this URL:

krona.html?dataset=7&node=3432&collapse=true&color=false&depth=34&font=11&key=true

However, when I use that URL with the phantomjs program, it fails. For example, this call fails: phantomjs rasterize.js krona.html?dataset=7&node=3432&collapse=true&color=false&depth=34&font=11&key=true krona_snap.png. This might be an issue with phantomjs rasterize.js, but I thought I would post here in case anyone figured it out. Thanks so much for Krona -- it's awesome!

toddknutson avatar Jul 13 '17 17:07 toddknutson