Mobile app version of vmapp.org
Login or Join
Kaufman565

: How can I create a specifically located line in Gimp? How can I add a plain black line in an image in Gimp in specific pixel coordinates for example between (10,15)->(300,116)?

@Kaufman565

Posted in: #Gimp

How can I add a plain black line in an image in Gimp in specific pixel coordinates for example between (10,15)->(300,116)?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Kaufman565

1 Comments

Sorted by latest first Latest Oldest Best

 

@Looi7658678

Open the Python console in filters->python->console -
get a reference to your image, typing

img = gimp.image_list()[0]


and press enter. Hit the browse button at the botton of the dialog and select gimp- paintbrush-default and hit apply - it will paste a template for calling that function in the Python console - something like this:

>>> pdb.gimp_paintbrush_default(drawable, num_strokes, strokes)


Go back with the arrow keys and edit it so that it reads:

>>> pdb.gimp_paintbrush_default(img.layers[0], 4, [10,15,300,116 ])


And press enter.
The img.layers[0] parameter is a reference to the layer - "0" is the top most layer in the image, 1, the second from top to bottom, and so on. (Likewise, in the previous command img = gimp.image_list()[0] retrieves a reference to the last image open in GIMP, and changing the number in square bracktes selects other images).

After the first stroke, you can simply hit up arrow, and get the command back, where you can fill in new coordinates for the line. Also, of course, you can explore the procedures available in the "Browse" button, and use any of them you like.

As few people do this, I'v just noticed a bug: in GIMP 2.8, it ignores the brush size set in the tool options. So you will have to create a brush of the size you want and set it before doing the line.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme