forked from your-land-mirror/compass_rose
initial texture source and a script to crop it
This commit is contained in:
commit
5085276f3e
BIN
compass_rose.kra
Normal file
BIN
compass_rose.kra
Normal file
Binary file not shown.
35
krita_save_cube_sides.py
Normal file
35
krita_save_cube_sides.py
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user