Mobile app version of vmapp.org
Login or Join
Steve758

: GIMP: Stroke Path along single points What I need: to draw different sets of icons in the same points of the picture (with the purpose of drawing different network schemes with the same structure).

@Steve758

Posted in: #Brush #Gimp #Path #Stroke

What I need: to draw different sets of icons in the same points of the picture (with the purpose of drawing different network schemes with the same structure). There are A LOT OF Points.
Therefore I want to be able to separate the production of the icon and the positions of them in the final picture, i.e. I don't want to draw the icon and then copy and paste it in different points, since I would not be able to change the sets of icons without having to redraw everything.

Attempted Solution: I thought of i) draw the icon and save it as a brush, ii) draw single points with the path tool in the proper positions, iii) stroke the path using the icon brush. Iterate step iii) with different brushes.

Problem: Stroke Path.. does not work with single points. However, if I use short paths instead of single points there is an issue with the spacing: in the path I have sometimes 2 icons, sometimes 1 and sometimes 0.

Am I addressing the issue in the wrong way? Is there a solution?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Steve758

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL875

So, indeed this can be considered a path-stroking bug - or at least missing feature. Even if GIMP developers can fix it, a new release with the feature implemented could take months.

On the other hand, this kind of thing is more or less easy to do using the script-engines that come along with GIMP. The following 6 lines of code can be pasted as they are in GIMP's Python console (Filters->Python->Console) - They will create a single "1-click-stroke" for each node (not each single node component) on a path, on the topmost layer of the latest open image (rightmost tab). (Change the 0 on the first line to get to other open images, in order, from right to left)

img = gimp.image_list()[0]
for vector in img.vectors:
for stroke in vector.strokes:
for i in range(2, len(stroke.points[0]), 6):
x, y = stroke.points[0][i: i + 2]
pdb.gimp_paintbrush_default(img.layers[0], 2, [int(x), int(y)])


Of course, to paste this each time you need to perform the task is cumbersome. To create a plug-in from this, follow the example and instructions at www.gimp.org/docs/python/ (these lines are to become the function body - and you should register three paramters: PF_IMAGE, PF_DRAWABLE and PF_VECTORS where that example only have "PF_INT"). Save the file with a ".py" extension in the plug-in folder, and for non-windows platforms, mark it as executable (using file properties) )

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme