Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Add toggle for bilinear filtering
Austin Andersondbde275dc2f6
diff --git a/plugins/python/batch_exporter/Config.py b/plugins/python/batch_exporter/Config.pyindex 9ece80df6a..298586d4ab 100644--- a/plugins/python/batch_exporter/Config.py+++ b/plugins/python/batch_exporter/Config.py@@ -12,6 +12,6 @@ CONFIG = {"error": {"msg": "ERROR: {}", "timeout": 8000},"done": {"msg": "DONE: {}", "timeout": 5000},"delimiters": OrderedDict((("assign", "="), ("separator", ","))), # yapf: disable- "meta": {"c": [""], "e": ["png"], "m": [0], "p": [""], "t": [""], "s": [100], "i": [""]},+ "meta": {"c": [""], "e": ["png"], "m": [0], "p": [""], "t": [""], "s": [100], "i": [""], "b": [""]},}CONFIG["sym"] = re.compile(CONFIG["sym"])diff --git a/plugins/python/batch_exporter/Infrastructure.py b/plugins/python/batch_exporter/Infrastructure.pyindex b179a1fc8f..73968fb5d9 100644--- a/plugins/python/batch_exporter/Infrastructure.py+++ b/plugins/python/batch_exporter/Infrastructure.py@@ -9,7 +9,7 @@ from itertools import groupby, product, starmap, teefrom pathlib import Pathfrom krita import Krita-from PyQt5.QtCore import QSize+from PyQt5.QtCore import QSize, Qtfrom PyQt5.QtGui import QColor, QImage, QPainterfrom .Utils import flip, kickstart@@ -129,6 +129,15 @@ class WNode:else:return trim+ @property+ def bilinear(self):+ bilinear = self.meta_safe_get("b")++ if bilinear[0].lower() in ["false", "no"]:+ return False+ else:+ return bilinear+@propertydef parent(self):return WNode(self.cfg, self.node.parentNode())@@ -280,6 +289,7 @@ class WNode:margin, scale = meta["m"], meta["s"]extension, path = meta["e"], meta["p"][0]+ bilinear = meta["b"][0].lower() not in ["no", "false"]dirPath = (exportPath(self.cfg, path, dirname, userDefined=True)@@ -316,6 +326,7 @@ class WNode:lambda scale, margin, extension, path: ([int(1e-2 * wh * scale) for wh in self.size],100 - scale != 0,+ Qt.SmoothTransformation if bilinear else Qt.FastTransformation,margin,extension,path,@@ -323,8 +334,8 @@ class WNode:it,)it = starmap(- lambda width_height, should_scale, margin, extension, path: (- img.smoothScaled(*width_height) if should_scale else img,+ lambda width_height, should_scale, transform_mode, margin, extension, path: (+ img.scaled(*width_height, transformMode=transform_mode) if should_scale else img,margin,extension in ("jpg", "jpeg"),path,diff --git a/plugins/python/batch_exporter/Manual.html b/plugins/python/batch_exporter/Manual.htmlindex 8628c8fa4c..c3df3ed9fc 100644--- a/plugins/python/batch_exporter/Manual.html+++ b/plugins/python/batch_exporter/Manual.html@@ -9,9 +9,10 @@<ul><li><code>[e=jpg,png]</code> - supported export image extensions</li><li><code>[s=20,33.333,100,150]</code> - size in <code>%</code>.</li>+<li><code>[b=false]</code> or <code>[b=no]</code> - disable bilinear filtering when scaling layers.</li><li><code>[p=path/to/custom/export/directory]</code> or <code>[p="path with spaces"]</code> - custom output path. Paths can be absolute or relative to the Krita document.</li><li><code>[m=20,30,100]</code> - extra margin in <code>px</code>. The layer is trimmed to the smallest bounding box by default. This option adds extra padding around the layer.</li>-<li><code>[t=false]</code> or <code>[t=no]</code> - disable trimming the exported layer to the bounding box of the content.</li>+<li><code>[t=false]</code> or <code>[t=no]</code> - disable trimming the exported layer to the bounding box of the content. This option is not inherited from parent layers.</li><li><code>[i=false]</code> or <code>[i=no]</code> - disable parent metadata inheritance for a layer. More info <a href="#layer-inheritance">below</a>.</li></ul><p>A typical layer name with metadata looks like: <code>CharacterTorso e=png m=30 s=50,100</code>. This exports the layer as two images, with an added padding of 30 pixels on each side: <code>CharacterTorso_s100_m030.png</code>, and <code>CharacterTorso_s050_m030.png</code>, a copy of the layer scaled down to half the original size.</p>diff --git a/plugins/python/batch_exporter/Manual.md b/plugins/python/batch_exporter/Manual.mdindex 66194e8d0c..81d3c7fcbb 100644--- a/plugins/python/batch_exporter/Manual.md+++ b/plugins/python/batch_exporter/Manual.md@@ -14,13 +14,13 @@ the layer name. The supported options are:- `[e=jpg,png]` - supported export image extensions- `[s=20,33.333,100,150]` - size in `%`.+- `[b=false]` or `[b=no]` - disable bilinear filtering when scaling layers.- `[p=path/to/custom/export/directory]` or `[p="path with spaces"]` - custom output path.Paths can be absolute or relative to the Krita document.- `[m=20,30,100]` - extra margin in `px`. The layer is trimmed to thesmallest bounding box by default. This option adds extra padding around thelayer.-- `[t=false]` or `[t=no]` - disable trimming the exported layer to the bounding box of- the content.+- `[t=false]` or `[t=no]` - disable trimming the exported layer to the bounding box of the content. This option is not inherited from parent layers.- `[i=false]` or `[i=no]` - disable parent metadata inheritance for a layer. More info [below](#layer-inheritance).A typical layer name with metadata looks like: `CharacterTorso e=png m=30 s=50,100`. This exports