mirror of
https://github.com/minetest/minetest.git
synced 2024-12-28 00:47:29 +01:00
Add options for screenshot format and quality
This commit is contained in:
parent
37b4f0d34c
commit
2c72f6da7b
@ -554,6 +554,14 @@ fallback_font_shadow_alpha (Fallback font shadow alpha) int 128 0 255
|
||||
# Path to save screenshots at.
|
||||
screenshot_path (Screenshot folder) path
|
||||
|
||||
# Format of screenshots.
|
||||
screenshot_format (Screenshot format) enum png png,jpg,bmp,pcx,ppm,tga
|
||||
|
||||
# Screenshot quality. Only used for JPEG format.
|
||||
# 1 means worst quality; 100 means best quality.
|
||||
# Use 0 for default quality.
|
||||
screenshot_quality (Screenshot quality) int 0 0 100
|
||||
|
||||
[**Advanced]
|
||||
|
||||
# Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens.
|
||||
|
@ -653,6 +653,16 @@
|
||||
# type: path
|
||||
# screenshot_path =
|
||||
|
||||
# Format of screenshots.
|
||||
# type: enum values: png, jpg, bmp, pcx, ppm, tga
|
||||
# screenshot_format = png
|
||||
|
||||
# Screenshot quality. Only used for JPEG format.
|
||||
# 1 means worst quality; 100 means best quality.
|
||||
# Use 0 for default quality.
|
||||
# type: int min: 0 max: 100
|
||||
# screenshot_quality = 0
|
||||
|
||||
### Advanced
|
||||
|
||||
# Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens.
|
||||
|
@ -1813,9 +1813,12 @@ void Client::makeScreenshot(IrrlichtDevice *device)
|
||||
+ DIR_DELIM
|
||||
+ std::string("screenshot_")
|
||||
+ std::string(timetstamp_c);
|
||||
std::string filename_ext = ".png";
|
||||
std::string filename_ext = "." + g_settings->get("screenshot_format");
|
||||
std::string filename;
|
||||
|
||||
u32 quality = (u32)g_settings->getS32("screenshot_quality");
|
||||
quality = MYMIN(MYMAX(quality, 0), 100) / 100.0 * 255;
|
||||
|
||||
// Try to find a unique filename
|
||||
unsigned serial = 0;
|
||||
|
||||
@ -1837,7 +1840,7 @@ void Client::makeScreenshot(IrrlichtDevice *device)
|
||||
raw_image->copyTo(image);
|
||||
|
||||
std::ostringstream sstr;
|
||||
if (driver->writeImageToFile(image, filename.c_str())) {
|
||||
if (driver->writeImageToFile(image, filename.c_str(), quality)) {
|
||||
sstr << "Saved screenshot to '" << filename << "'";
|
||||
} else {
|
||||
sstr << "Failed to save screenshot '" << filename << "'";
|
||||
|
@ -123,6 +123,8 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("invert_mouse", "false");
|
||||
settings->setDefault("enable_clouds", "true");
|
||||
settings->setDefault("screenshot_path", ".");
|
||||
settings->setDefault("screenshot_format", "png");
|
||||
settings->setDefault("screenshot_quality", "0");
|
||||
settings->setDefault("view_bobbing_amount", "1.0");
|
||||
settings->setDefault("fall_bobbing_amount", "0.0");
|
||||
settings->setDefault("enable_3d_clouds", "true");
|
||||
|
@ -272,6 +272,10 @@ fake_function() {
|
||||
gettext("Fallback font shadow alpha");
|
||||
gettext("Screenshot folder");
|
||||
gettext("Path to save screenshots at.");
|
||||
gettext("Screenshot format");
|
||||
gettext("Format of screenshots.");
|
||||
gettext("Screenshot quality");
|
||||
gettext("Screenshot quality. Only used for JPEG format.\n1 means worst quality; 100 means best quality.\nUse 0 for default quality.");
|
||||
gettext("Advanced");
|
||||
gettext("DPI");
|
||||
gettext("Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens.");
|
||||
|
Loading…
Reference in New Issue
Block a user