Can I add to a vector library?

One thing I used to do a lot in photoshop was to make custom shapes that I’d use later in painting, which for some more graphical styles makes it a lot faster. They were really easy to make, all I needed was a selection and to choose an option from a menu and save it, then I could drag them out and have them appear rasterized and ready to paint into. So for instance if I paint some black silhouettes of trees, I can then select them and save the shape, and quickly place a bunch of them in an image later, not having to worry about their resolution as with brushes.

I’ve been wanting to recreate this in krita, as it does have some part of this ability in that it has a vector library docker that lets me drag them out quickly, and I can convert them into raster without much fuss even if it’s not automatic.

However, I can’t figure out how to make a new shape. I am a bit confused by the documentation for libraries, as it says “Currently, you cannot make symbol libraries with Krita yet, but you can make them by hand, as well as use Inkscape to make them.” and I do not know what making them by hand would imply, as opposed to using another program. Does this mean that while it could not make a ‘library’ itself, I could still create shapes for one in krita? Or would the whole process need to be external?

Hello - Yes you can make library by inkscape or Krita itself granted they are vector and formatted as symbol/ or many symbol.

I have done so several times; Though I’m more familiar with the notepad method since I do more than 10 symbols in one library.

Me and @AhabGreybeard have different written method you can use. There is a guide as answer to a previous question. A starter file can be found on this thread.

Goodluck.

Thanks, I think if I understand it correctly then for my process to work I would need to create my selection, export it and trace it in inkscape to vector, and then either add it to a library within inkscape or by editing the svg file.

I will give it a shot and see how it goes. However from the sound of it I’m suspecting that if I continue this process in krita I may make the quality sacrifice of using brushes for shapes instead, as it sounds a lot slower than the way I used to do it before, while the process for brush tips is very similar to making a PS-style custom shape.

All you really need to do is export them as svg in krita and put them inside the symbol and the parent text file.

You can skip some of the process with a script (Krita 5, can be done in Krita 4 too but you gotta use the copy and paste workaround):

from krita import *

qwin = Krita.instance().activeWindow().qwindow()
doc = Krita.instance().activeDocument()
node = doc.activeNode()

text, ok = QInputDialog.getText(qwin,'Shape Name', 'Name for shape:')

for shape in node.shapes():
    if shape.isSelected():
        dlg = QDialog(qwin)
        layout = QVBoxLayout(qwin)
        textEdit = QTextEdit()
        textEdit.setPlainText('''<symbol id="'''+text.replace(' ','').replace('"','')+'''">
      <title>'''+text+'''</title>
      '''+shape.toSvg()+'''
      </symbol>''')
        layout.addWidget( textEdit )
        dlg.setLayout(layout)
        dlg.exec()

So all you gotta do is paste the result of running that script in a text file. The whole thing can probably be automated into a script pretty easily.

1 Like

I suggest that you study this minimal vector library by opening it in Notepad++ or some other syntax highlighting editor:
Minimal-MLVL.svg

I did try exporting but the trouble is that I don’t create the shapes as vector to begin with and as far as I could tell it would not export that as svg? I could probably learn to draw them in vector but I also make some from photos, by removing colour and editing levels to get a good silhouette, so I assumed that tracing in inkscape is probably a necessary step for me unless krita has/gains the ability to do that.

You can trace in krita. It has vector drawing tools :slight_smile:

Thanks, I’ll have a look at these and see if I can figure it out. To be clear when I say trace I mean the trace bitmap functionality that inkscape uses, I was looking for something like that but could not find it.

Right, krita doesn’t have that particular ability.
I suggest that you use the Freehand Path tool with Precision set to Curve, Optimise enabled and Precison = 0.5 (adjustable to give more or fewer points on a drawn curve).

After that, you can use the Edit Shapes tool, as in the tutorials, to make final adjustments as needed.

One key is what @AhabGreybeard I suggest you study some of it

EDIT: I didnt read you are looking for a Krita only solution. I should not answer when i just woke up from a nap.

I hid my answer as its not necessary anymore. My bad.

Trace bitmap in inkscape guide

The other way is a shortcut that only works on black and white drawing/ graytone drawing the best.

  • I draw in Black and White
  • Copy and paste that to inkscape. I just straight up copy it / just make sure the background is white or light color.
  • then on inkscape I use the trace to bitmap feature.
    –Select the Image you copy pasted.
    –On menu path > Trace to bitmap

Set it to brightness cutoff and play with threshold value - I find .450 to .750 to be good.
A value of 1 will be all black and 0 is white - so depending on the contrast of your image.

–Just hit ok.

–There you now have an SVG.

From there on you can save this svg and open it in a notepad - Following the steps laid down above.

If the artwork is complicated, hand tracing in krita would be a long and boring task and prone to error.

It would be a good idea to explore/learn the Inkscape bitmap tracing facilities.
I’ve just played with it and after some initial confusion I figured it out, a little.
I’m sure there will be YouTube video tutorials for it.

@Lame_Fox

If you want to learn the basic of tracing bitmap as AHAB suggested - You can view my hidden reply. Its just the steps.

Well, for better understanding, or to clear up the possible misunderstanding, SVG stands for “Scalable Vector Graphic” and therefore accepts only vector graphics, as you already noticed.

Michelist

Might be a bit off the mark and still unusefull to use as the whole workflow needed for this.

But photobash should be able to import custom SVG libraries in the future, my fork is already doing it. Even if it still needs some work it does it.

What it is needing next is for krita to be able to transform vector objects more like image objects like Photoshop.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.