aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp7
-rw-r--r--src/defaultsettings.cpp2
-rw-r--r--src/settings_translation_file.cpp4
3 files changed, 11 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp
index f27f031c5..e13344ec2 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -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 << "'";
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index db2950fc2..53059e8ad 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -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");
diff --git a/src/settings_translation_file.cpp b/src/settings_translation_file.cpp
index e92a34cba..f115bc011 100644
--- a/src/settings_translation_file.cpp
+++ b/src/settings_translation_file.cpp
@@ -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.");