commit 5085276f3e493d2ad76ad6fedb4edcb4cc9cbb8a Author: whosit Date: Sat Mar 1 12:42:47 2025 +0300 initial texture source and a script to crop it diff --git a/compass_rose.kra b/compass_rose.kra new file mode 100644 index 0000000..4152f8a Binary files /dev/null and b/compass_rose.kra differ diff --git a/krita_save_cube_sides.py b/krita_save_cube_sides.py new file mode 100644 index 0000000..2d1382f --- /dev/null +++ b/krita_save_cube_sides.py @@ -0,0 +1,35 @@ +# crop 3x3 image into 6: corner, center, and 4 directions (only top-left corner is used) + +import os +print(os.getcwd()) + +import krita +currentDocument = Krita.instance().activeDocument() +import os.path +filepath = currentDocument.fileName() +filename = os.path.splitext(os.path.basename(filepath))[0] +dir = os.path.dirname(filepath) + +print(dir) +currentDocument.setBatchmode(True) +s = 16 +corners = [ + [0,0], [s,0], + [0,s], [s, s], [s*2, s], + [s, s*2], + ] +for i,c in enumerate(corners): + clone = currentDocument.clone() + print(c[0], c[1]) + clone.crop(c[0], c[1], s, s) + exportParameters =krita.InfoObject() + exportParameters.setProperty("alpha", True) + exportParameters.setProperty("compression", 6) # 0-9 + exportParameters.setProperty("indexed", False) + res = clone.exportImage(os.path.join(dir, f"{filename}_side{i}.png"), exportParameters) + clone.close() + print(res) + if not res: + break + +currentDocument.setBatchmode(False) \ No newline at end of file