core.screenshot(…) takes a screenshot of the scene currently rendered in Stellarium.
screenshot (
prefix , // string, prefix of file name
invert , // boolean, default = false, compare value of invert_screenshots_colors in config.ini
dir , // string, directory where image of screenshot is stored, compare value of screenshot_dir in config.ini
overwrite, // boolean, default = false,
format // string, 'png', 'jpg' etc…
)
If the directory is not specified, the screenshot is stored in the default directory that is specified in the config.ini file under the section [main].
If overwrite is false, the name of the image is prefix_DDD.format where ddd is the next number 000 -> 001 -> 002 -> …
If overwrite is true, The value of prefix.formatis the name of the created image.
Example
// vi: ft=javascript
// Go to Irchelturm
//
core.setObserverLocation(
8 + 36/60 + 25.85/60/60, // core.dmsToRad( 8, 36, 25.85 ), // longitude
47 + 32/60 + 21.48/60/60, // core.dmsToRad(47, 32, 21.48 ), // latitude
0, // Altitude
0, // Time to travel
"", // or "Irchelturm",
"Earth" // This parameter seems necessary
);
// Set date and time of observation
//
core.setDate(
'2020-10-10T21:30:00',
'local' , // or 'utc'
true // enable Delta T correction
);
StelMovementMgr.zoomTo(25, 0.01);
core.wait(0.01); // Why, oh why is this necessary?
core.moveToRaDec(22.43719, 5.925423);
// Take screenshot
//
core.screenshot(
'screenshot-test' ,
false , // invert
core.getEnv('github_top_root') + 'about/Stellarium/API/core', // directory
true , // overwrite
'png' // format
);