Save quick sketches

I use krita to (quickly) sketch a lot and I save the sketches (at times like 15 or more for an evening) so I can look at progress over time. I write a script which saves all files with date_counter (for example 2019-11-05_3.kra). I don’t know if anyone else would find it useful, but here it is in case it would be helpful to you.

from PyQt5.QtGui import * from PyQt5.QtWidgets import * from datetime import date from pathlib import Path from krita import * import sys

count=0
path = “C:\Users\tobbew\Pictures\”+str(date.today())
k = Krita.instance()

lastDoc = None
doc = k.activeDocument()
while( not doc == lastDoc):
lastDoc=doc
doc = k.activeDocument()
if(doc.fileName()==""):
count= count+1
# create a new file
newfile = Path(path+""+str(count)+".kra")
while( newfile.exists() ):
count=count+1
newfile = Path(path+"
"+str(count)+".kra")
print(str(newfile))
if(doc.saveAs(str(newfile))):
doc.close()
doc=Krita.instance().activeDocument()
else:
break
else:
#save file
if(doc.save() ):
doc.close()
doc=Krita.instance().activeDocument()
else:
break

4 Likes

I forgot to mention, you should of course replace the path = line above to the folder where you want the files saved (it should exist, existance is not tested).

1 Like

Any plan on making this a plugin file which users can just copy paste and use it?

1 Like

How do you make a plugin? I run it from Tools->Scripts->Scripter (which works for me).

I found the documentation. Does not seem like it should be too difficult. I’ll look into it.