Update [11/15/2009] : Added fixed brush width and double headed error, removed bug 1) one-point-paths, 2) horizontal paths
Update [11/16/2009] : Fixed image type restriction string
Update [11/19/2009] : Added feature for absolute wing length, fixed handling gray-scale images
Update [25/01/2010]: Fixed fixed opacity bug (thanks to Richard)
This plugin enables GIMP to draw an arbitrary arrow into an image or a new layer. The plugin has reasonable default values for every paramtere but is freely adjustable to ones needs. Parameters are:

Usage:
Create a path (usually <B>) with the head of the arrow (first anchor point) and the end of the tail (second anchor point). Then call the script which adds itself to the "Tools" menu (I use <AltGr+P> as the shortcut as "Pfeil" is the german word for arrow).
ToDo:
You can also contact me via ICQ #52712314 and Jabber/XMPP Hoffmann.P@jabber.ccc.de
| Attachment | Size |
|---|---|
| Description.png | 47.5 KB |
| arrow.scm | 11.24 KB |
Comments
plugin location on Macs
Mac users, the plugin needs to go here:
/Applications/Gimp.app/Contents/Resources/share/gimp/2.0/scripts/
(works great, Mac OS 10.7.2, Gimp 2.6.11)
It would be cool if
It would be cool if the arrow tool could be combined with Ofnut's plug-in http://registry.gimp.org/node/25946.
Arrows
Arrrg!!! I can't understand why the programs does not have arrows!!! Yes there is a Plug in!!! But installing is a pain!!! Can't get it to work. Time to uninstall and move on!!!!!!!!!!!!!!!!!
What about the script isn't working?
Can you at least elaborate a little more about what problems you are encountering, before giving up?
Arrow
I can not get an arrow with the arrow tool? Under Tools I have Arrow, but nothing about arrows in the toolbox. What am I missing?
No Menu
Just to clarify, when you click arrow under the Tools menu you don't get this menu option?
What version of GIMP are you using, what Operating System do you have? (Windows 7, Vista, XP, Mac).
I would remove the script from the scripts folder and reinstall it. You can see how adding scripts is done here:
http://allthingsgimp.blogspot.com/2009/09/gimp-how-to-install-scripts-pl...
Arrow not working
Yes I get get the menu option. I did reload, it's still not working. I'm using Gimp 2.6.11. on a Windows 7 PC.
So this is what I'm doing, please tell me what I'm doing wrong.
1. Open a new file.
2. Select Tools/Arrow
3. Get Menu Option select OK (using Default)
4 Get GIMP Arrow Message about first and last point of path.
5 Select Pencil from Toolbox (I would think I would get an Arrow Tool)
6. Draw a line point to point.
7. I fell I would get an arrow point on this line. But NO arrow???
What I'm looking for is a line with an arrow point on it. How do I get that?
Thanks for your help.
2Old
Use Path tool
Click on the Path tool
and click two points on a new transparent layer over an image or drawing. Then run the arrow script. For the time being, leave the script menu at default.
Just keep in mind, the first Path point will always be the head of the arrow, until you uncheck that option in the menu.
Arrow Tool
Found it!!! Thanks. Now it's working.
2Old
Choose arrow from a visual template rather than by text&numbers
Very useful plugin, thank you.
It would be, however, much easier to use if one were able to draw the arrow by selecting between a few visual templates, rather than by having to fill in numerical coefficients for geometric parameters describing the various components of an arrow that aren't necessarily very intuitive.
If there were a few samples of the various categories of arrows, the user can immediately recognise the type of arrow they want, and then just tweak one or two parameters (rather than 4 as it is right now) for their desired type of arrow.
It would be great to see this change implemented in a new version.
Thanks :)
tutorial in English
see "How to Draw Arrows in Gimp" @ http://maketecheasier.com/draw-arrows-in-gimp/2010/12/25
translation
Hi, I've translated your plugin in French, it is available here : http://lehollandaisvolant.net/tout/dl/gimp-plugin/arrow-fr.scm .
Here is also a tutorial, in French : http://www.commentcamarche.net/faq/30547-creer-des-fleches-dans-gimp
Thanks for the plugin :)
Error while trying to use arrow.scm
OK, I'm a gimp newbie and have placed arrow.scm in the appropriate place, and it appears under my tools tab. BUT, I can never get it to work. It is probably just my idiocy in understanding the steps required to make a bloody arrow, but all I ever get is:
Error while executing
(script-fu-draw-arrow 1 2 -2.5 25 TRUE 75 -25 TRUE FALSE TRUE FALSE FALSE)
ERROR: unbound variable (errobj gimp-image-get-active-vectors)
Does this create an "Oh yeah - the dummy isn't doing X right"? response? If so, please let me know what I'm doing wrong. Step by step instructions on how to make the arrow would be wonderful. I'm confused by the layers, whether to use pencil or brush, etc... however, no matter what I do, I only get the above error. Every time. I'm running Debian. Apparently I'm not doing things to create appropriate "active vectors", but I have no idea why or how to fix this. Thanks, Bill
I'm using Gimp 2.2
Just in case that is of any use to anyone.
GIMP 2.2 is too old
Seriously, GIMP 2.2 doesn't support some Script-FU procedures. So you should use at least GIMP 2.6.
2 B-Ranger: please change version identeficator to 2.6 (in script edit interface).
Warn about erroneous count of path points
Hi,
whilst using this plugin, I tried to draw an arrow with only one point. Naturally, this didn't work and arrow.scm painted the whole background in the selected color (or created a new, transparent layer only.)
Please include some warnings depending on the count of selected path points:
Zero to one path point: no arrow drawing possible.
Two path points: no error message.
Three or more path points: draw arrow, but though warn the user that only the first and last path points will be used as the arrow's head/tail.
Thank you for your help once again.
Best regards,
Mihai
Warn about erroneous count of path points
I'm not sure that Berengar is still supporting this script - if not I will make these changes in a few days time.
Feature-Wish:Save Settings
First of all, congratulations for this superb plugin.
It works great for me, I'm using it for writing manuals with pictures.
If the plugin save the user settings f.e. with a "save settings" button, the arrow tool would be nearly perfect.
Do you know a way to realize this?
TIA
Feature-Wish:Save Settings
I stand to be corrected but I don't know of a way to access data files (to store the settings) from Script-fu scripts.
If there is a way then this would be possible but it would not be elegant due to the way that the script sets the default values for the parameters. You could have an option box that allowed three options:
1) use the parameters from the script dialog
2) use the parameters from the script dialog and save them for next time
3) use the saved values
The problem is that you wouldn't know what the saved parameters were - the script can't (so far as I am aware) read the previous settings and display in the parameter boxes of the dialog for you to change.
If you want one or more of the parameters always set to the same value then the easiest thing to do is to edit your copy of the script file (any text editor can be used for this).
Line Width
Hi,
This is a great script. Thank you so much for creating it. I'm not a Gimp guru, so maybe this question is on the dumb side, but I do not see a way to adjust the line width. I would like to have an arrow with hard corners and a wide line, but it seems that the larger the brush stroke the softer (curvier) the arrows. Any suggestions?
Many thanks for the great work!
Works only with a brush tool
Hi,
Thank you very much for this script! I have been missing a good arrow tool very much for a long time. Moreover, the arrows that this scripts makes are really nice.
However, it was very difficult to find out how this script works. I did what you suggested: made a path and ran the script, and it did nothing. If Fill head arrow was on, a nice little head was drawn without the line of the arrow.
I never dreamed that after drawing the path I have to switch to a brush tool to get the script work as it is intended. Without the last comment, I would never found out how to use the script. Now it works, but it is pretty slow and annoying that after drawing the path, I have to choose a brush tool. If you only make one or two arrows, this may be no problem, but if you make a lot of arrows, this slows down the workflow. And I don't really see the point of it.
Anyway, the script is nice, just that it could be more straightforward.
Thanks,
Abel
Same here
Apparently, between the last updates on the script something got changed, because arrow.scm is doing the same thing with me (draws arrow head but no tail).
Brush tool problem
I have just looked at this again. If I don't have a brush type tool selected I get a 'ragged' arrow. I noticed that I get the same effect if I have a brush type tool selected with the layer mode set to dissolve. I have therefore modified the script so that it temporarily sets the brushes paint mode to Normal.
In total I added 4 extra lines of code. I added the three lines with "; 6.3.2010" in the following section:
(PreviousOpacity 100.0)
(PreviousPaintMode 0) ; 6.3.2010
)
(begin
(set! PreviousOpacity (car (gimp-context-get-opacity)))
(gimp-context-set-opacity 100.0)
(set! PreviousPaintMode (car (gimp-brushes-get-paint-mode))); 6.3.2010
(gimp-brushes-set-paint-mode NORMAL-MODE) ; 6.3.2010
; collect points for arrow-tail and draw them
(aset points 0 inPointToX) (aset points 1 inPointToY)
(aset points 2 inPointFromX) (aset points 3 inPointFromY)
and the line with "; 6.3.2010" in the following section:
(gimp-selection-none image)
))
(gimp-brushes-set-paint-mode PreviousPaintMode) ; 6.3.2010
(gimp-context-set-opacity PreviousOpacity)
(I will email the whole script to Berengar on Monday when I have his email to hand.)
Hope this helps
Works brilliantly
Thanks for the code updates, p_c. Arrow.scm is now working properly. :)
Pleased to hear that it works for you too
This removes a niggle from a script that i find very useful.
I have noticed this morning that the gimp-brushes-set-paint-mode and its companion get function are deprecated and should be replaced by the gimp-context-set-paint-mode and gimp-context-get-paint-mode functions respectively (the script still seems to work in exactly the same way).
Opacity
I am using the default settings for the script with the foreground colour set to white.
The filled in centres of the arrow-heads always appear to be at 100% opacity.
If the selected tool is the paths tool, the select by colour tool, the rectangular selection tool .... (i.e. a non-drawing tool) then the remainder of the arrow appears at less than 100% opacity.
If the selected tool is the brush, pencil, eraser ... all parts of the arrow appear to be 100% opaque.
Update 22.1.2010
The problem is caused by the context opacity not being set to 100% - what controls the context opacity at the GUI level?
Fixed
Bug Fixed :-)
Club Mate is healthy sleep in pint bottles
Great plugin
Thank you for this plugin. For me advanced arrow tool was the killer feature of Paint.NET. I hope one day this plugin will be as powerful. Very promising as for something less than 1 month old. :)
The arrow is always straight line and does not really follow the path spline.
The parameter to control thickness is very counter-intuitive. Human readable thickness number (preferably always positive) and better documentation would be nice.
I see that it is a problem
I see that it is a problem to want to offer the possibility to use relative and absolute values at once, I will have to think about a good solution. I should probably add more drop-down boxes that enable the user to decide how he wants his arrows.
I my self stumbled across the length-dependent thickness when I wanted to draw to arrows with different length into my image. Maybe the script should be redone as a plugin...
I will add the drawing of splines and not-one-line-arrows to the todo-list. Are there any more features in Paint.NET that should be included?
---
Club Mate is healthy sleep in pint bottles
Curvy arrows
count me in as someone else who wants curvy, spline-hugging arrows. Badly enough, as it is, that I started thinking about how to do it. The hardest part, I think, is how the arrow head should be drawn. I see three ways to do it:
1a: stick to straight lines for the arrow head, and orient it so that the tangent to the arrow body at the arrow tip bisects the arrow head.
1b: stick to straight lines for the arrow head, and orient it so that the arrow body intersects it at the midpoint of the base of the arrow head.
2: use curved lines for the arrow head (basically, by rotating the spline by appropriate angles (and truncating it) and (for the base of the arrow head) moving the rotated spline so it intersects the other 2 forming the arrow head in the appropriate positions.
1a and 1b are reasonably straightforward (maybe more so for 1b, because it doesn't require figuring out that tangent), but will look ugly, or at least weird, if the arrow body is very curvy (in extreme cases, the body may stick out one side of the arrow head. On the flip side, 2 would require more work (maybe significantly so) to create the boundary of the arrowhead, but I think it's worth the effort.
What do you think? Is there something I missed? (Either another way to do it or a pro or con of one or more of 1a, 1b, and 2?)
arrow head size
Hi, great script, works well. I just have one problem, the fact that the arrow head size is always relative to the size of the length of the arrow. I would like to be able to draw a set of arrows of different length, but with the same head size. as it is now if I want to draw a long arrow the head ends up being quite large, at a minimum of 1/5th the size of the arrow length.
A small other thing I don't quite understand how the line thickness in the scrip is related to line thickness of brushes. In a figure I was working on arrow thickness of 2 seemed to correspond to brush size 5-6 pixels.
Cheers, thanks for this.
Re: arrow head size
Thank you, I added the feature to set a fixed (pixel) size for the arrow head (wing length is what I called it) as it was already existing for the line thickness. Again negative values are relative to the arrow length, positive values stand for absolute pixel values.
The line thickness of the script is not connected to the active brush. The script creates a new circle shaped brush and sets it size relative to the length of the arrow or absolute - depending on the line width parameter.
---
Club Mate is healthy sleep in pint bottles
Nice!
This is a nice script.
I would, however, submit the following comments:
* There is no reason to limit the script to RGB* images; it should work fine -- and prove just as useful -- on grayscale and indexed images (or on layermasks and channels in an RGB image).
* I don't think the script should destroy the path; paths use very little memory (relatively) and the user may need it for other purposes.
* Personally, I would find it more intuitive if the arrow were drawn in the direction from the starting point of the path to the ending point. (This would probably mean that the script should use the last two points of the last stroke of a multi-stroke path.)
Re: Nice!
Thanks!
* I unlimited the script (at least I think I did so by removing the limit)
* The deletion of the path is now optional and default is off
* Now you can change the direction of the arrow, default is the old setting. I still use the two outer strokes.
Club Mate is healthy sleep in pint bottles
Slight error in script
> * I unlimited the script (at least I think I did so by removing the limit)
It appears that in doing this, an error (most likely of the "copy-n-paste" variety) cropped up. You have substituted a "(Versionhistory:..." string where the drawable constraint string (e.g., "RGB*", "Grayscale*", etc) is expected. You want to substitute an asterisk (within quotes: "*"), indicating that any image type is acceptable.
Your script still functions with the bad string (the GIMP is apparently forgiving in this instance), however, it does fail to provide the "Repeat Arrow" and "Re-show Arrow" capabilities.
Re: Slight error in script
All right, thank you for that hint! I was already wondering where that nice blank line came from ;-)
---
Club Mate is healthy sleep in pint bottles
Error
Error: division by zero
Windows Vista 32 bit, using GIMP 2.6.7
Apparently the script requires you to create an active layer before setting your two path points. It was the only way I could get the script to work.
Error: Division by zero
I asume that this error occurred in the following to events:
1) you only have one point in your path
2) you have more then one point but the outer ones are on the same horizontal line. So their y-difference is there which I need(ed) for the calculation of the angle...
So, I fixed that error. If it occurs again I might have missed s.th. pleas update!
Club Mate is healthy sleep in pint bottles