Arrows in GIMP with 'arrow-fr.scm'
Solved
Anonymous user
-
Cindypolly -
Cindypolly -
Hello,
As a user of GIMP 2.8 (on Windows and/or Xubuntu), I installed the 'arrow-fr.scm' plugin to easily draw arrows. I first referred to the tutorial found here: https://www.commentcamarche.net/faq/30547-creer-des-fleches-dans-gimp, where thin arrows are shown.
However, I can only get relatively thick arrows, regardless of the settings I change in the configuration window.
Example:
... with the following parameters:
What should I do to get thin-stemmed arrows? Surely, there's something I've overlooked!
Thank you.
As a user of GIMP 2.8 (on Windows and/or Xubuntu), I installed the 'arrow-fr.scm' plugin to easily draw arrows. I first referred to the tutorial found here: https://www.commentcamarche.net/faq/30547-creer-des-fleches-dans-gimp, where thin arrows are shown.
However, I can only get relatively thick arrows, regardless of the settings I change in the configuration window.
Example:
... with the following parameters:
What should I do to get thin-stemmed arrows? Surely, there's something I've overlooked!
Thank you.
22 answers
- 1
- 2
Next
-
Thank you, Luke1, that's excellent information (fichier-zip.com). :-)
Here is the link: https://www.fichier-zip.fr/
••• Reminder: file contained in the ZIP to be placed in the GIMP installation folder, called "scripts" and containing the *.scm scripts; after restarting GIMP, an additional function line named ARROW will appear in the "Tools" menu... — Draw, in an image, a path made of at least two points BEFORE executing the command.-
-
Hello Piteu,
There you go, now everything is perfect and everything is being resolved upon request: https://www.cjoint.com/doc/18_02/HBgnF2QHVmS_Script.png
Thank you for the follow-up and the send. ;)
Luke.
-
-
Hello.
Contacted by me, two GIMP users among my friends loaded 'arrow-fr.scm'; they confirmed to me the same issue on their GIMP installation! Exactly the same phenomenon! :-(
What is surprising is that with VIAGERS it works perfectly... So there is probably a "background" setting that is established on his side and not on ours: but which one??? It seems to be independent of the system (although...): under Windows 10, Debian, Xubuntu, Ubuntu, the phenomenon occurs... (I don't know what system VIAGERS has.)
Does anyone have an idea? It would really help me if GIMP could do the arrows I want... ;-)-
-
Good evening,
Sorry, I've had this same script for ages and it has never worked correctly, whether with a GIMP from Partha or not, whether it's 2.8 or not, on Windows or Linux (two different distros)...
When I need arrows, I tweak them with the path tool and it works just fine.......... or almost... :(
I copied it from a text file that I saved as .scm, I installed it in French already saved as .scm, uninstalled/reinstalled anyway it won’t change anything since the script is an .scm file that I’m posting here in case someone finds a correction to make:
; Berengar W. Lehr (Berengar.Lehr@gmx.de)
; Medical Physics Group, Department of Diagnostic and Interventional Radiology
; Jena University Hospital, 07743 Jena, Thueringen, Germany
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; If you use this script and/or like it the author would be happy to
; receive a postcard from you:
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
; Version history:
; 11/10/2009 first release
; 11/15/2009 Added fixed brush width and double-headed error, removed bug 1) one-point-paths, 2) horizontal paths
; 11/16/2009 Fixed image type restriction string
; 11/19/2009 Added feature for absolute wing length, fixed handling gray-scale images
; 25/01/2010 Fixed fixed opacity bug (thanks to Richard)
; 28/12/2010 translated in French (<timovneerden-(at)-gmail-(d0t)-com>)
(define pi (* 4 (atan 1.0)))
(define
(script-fu-help-1Arrow
inPointToX
inPointToY
inPointFromX
inPointFromY
theWingLength
WingAngle
drawable
image
FullHead
MiddlePoint
)
(let*
(
; calculate absolute angle of both wings in image from relative angle
; between wings and arrow-tail and absolute angle of arrow-tail
(theArrowAngle (if (= (- inPointToY inPointFromY) 0)
(/ pi (if (< (- inPointToX inPointFromX) 0) 2 -2))
(+ (atan (/ (- inPointToX inPointFromX) (- inPointToY inPointFromY))) (if (> inPointToY inPointFromY) pi 0))
))
(theLeftAngle (+ theArrowAngle WingAngle))
(theRightAngle (- theArrowAngle WingAngle))
; calculate end points of both wings
(theLeftWingEndPointX (+ inPointToX (* theWingLength (sin theLeftAngle))))
(theLeftWingEndPointY (+ inPointToY (* theWingLength (cos theLeftAngle))))
(theRightWingEndPointX (+ inPointToX (* theWingLength (sin theRightAngle))))
(theRightWingEndPointY (+ inPointToY (* theWingLength (cos theRightAngle))))
(points (cons-array 4 'double))
(theMiddleWingEndPointX 0) (theMiddleWingEndPointY 0)
(PreviousOpacity 100.0)
)
(begin
(set! PreviousOpacity (car (gimp-context-get-opacity)))
(gimp-context-set-opacity 100.0)
; collect points for arrow-tail and draw them
(aset points 0 inPointToX) (aset points 1 inPointToY)
(aset points 2 inPointFromX) (aset points 3 inPointFromY)
(gimp-paintbrush-default drawable 4 points) (set! points (cons-array 4 'double))
; accordingly for left wing
(aset points 0 inPointToX) (aset points 1 inPointToY)
(aset points 2 theLeftWingEndPointX) (aset points 3 theLeftWingEndPointY)
(gimp-paintbrush-default drawable 4 points) (set! points (cons-array 4 'double))
; accordingly for right wing
(aset points 0 inPointToX) (aset points 1 inPointToY)
(aset points 2 theRightWingEndPointX) (aset points 3 theRightWingEndPointY)
(gimp-paintbrush-default drawable 4 points)
; only if head is to be filled
(if (= FullHead 1) (begin
; calculate intersection of connection between the wings end points and arrow tail
; shrink distance between this point and arrow head if MiddlePoint < 100
(set! theMiddleWingEndPointX (+ inPointToX
(* (/ MiddlePoint 100) (- (/ (+ theLeftWingEndPointX theRightWingEndPointX) 2) inPointToX))
))
(set! theMiddleWingEndPointY (+ inPointToY
(* (/ MiddlePoint 100) (- (/ (+ theLeftWingEndPointY theRightWingEndPointY) 2) inPointToY))
))
; collect points for left wing end - intersection - right wing end & draw it
(set! points (cons-array 6 'double))
(aset points 0 theLeftWingEndPointX) (aset points 1 theLeftWingEndPointY)
(aset points 2 theMiddleWingEndPointX) (aset points 3 theMiddleWingEndPointY)
(aset points 4 theRightWingEndPointX) (aset points 5 theRightWingEndPointY)
(gimp-paintbrush-default drawable 6 points)
; collect points to create selection which will be filled with FG color
(set! points (cons-array 8 'double))
(aset points 0 inPointToX) (aset points 1 inPointToY)
(aset points 2 theLeftWingEndPointX) (aset points 3 theLeftWingEndPointY)
(aset points 4 theMiddleWingEndPointX) (aset points 5 theMiddleWingEndPointY)
(aset points 6 theRightWingEndPointX) (aset points 7 theRightWingEndPointY)
(gimp-free-select image 8 points CHANNEL-OP-REPLACE TRUE FALSE 0)
(gimp-edit-bucket-fill drawable FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
(gimp-selection-none image)
))
(gimp-context-set-opacity PreviousOpacity)
) ; begin
) ; let
) ; define
(define
(script-fu-draw-arrow
image drawable
WingLengthRatio
WingAngle
FullHead
MiddlePoint
BrushThicknessOrRatio
; LineThicknessRatio
; BrushThickness
useFirstPointArrowAsHead
usePathThenRemove
useNewLayer
useDoubleHeadArrow
useless
)
(let*
(
(theActiveVector (car (gimp-image-get-active-vectors image)))
(theFirstStroke 0) (theStrokePoints 0)
(theNumPoints 0)
(inPoint_1X 0) (inPoint_1Y 0)
(inPoint_2X 0) (inPoint_2Y 0)
(theArrowLength 0) (theWingLength 0)
(oldLayer (car (gimp-image-get-active-layer image)))
(brushName "arrowBrush")
(oldBrushName (car (gimp-context-get-brush)))
)
(if (not (= theActiveVector -1)) (begin
(gimp-image-undo-group-start image)
; create new layer if asked to do so
(if (= useNewLayer 1) (begin
(set! drawable (car (gimp-layer-new image (car (gimp-image-width image))
(car (gimp-image-height image))
(+ 1 (* 2 (car (gimp-image-base-type image))))
"Arrow" 100 NORMAL-MODE )))
(gimp-image-add-layer image drawable 0)
; set new layer completely transparent
(gimp-layer-add-mask drawable (car (gimp-layer-create-mask drawable ADD-BLACK-MASK)))
(gimp-layer-remove-mask drawable MASK-APPLY)
))
; get path/vector points
(set! theFirstStroke (aref (cadr (gimp-vectors-get-strokes theActiveVector)) 0))
(set! theStrokePoints (caddr (gimp-vectors-stroke-get-points theActiveVector theFirstStroke)))
(set! theNumPoints (cadr (gimp-vectors-stroke-get-points theActiveVector theFirstStroke)))
; get position of arrow head and arrow tail from active vector
(set! inPoint_1X (aref theStrokePoints 2))
(set! inPoint_1Y (aref theStrokePoints 3))
(set! inPoint_2X (aref theStrokePoints (- theNumPoints 4)))
(set! inPoint_2Y (aref theStrokePoints (- theNumPoints 3)))
; calculate length of arrows depending on the length of the whole arrow
(define (sqr x) (* x x))
(set! theArrowLength (exp (* 0.5 (log (+ (sqr (- inPoint_1X inPoint_2X)) (sqr (- inPoint_1Y inPoint_2Y)))))))
(if (< WingLengthRatio 0)
(set! theWingLength (* theArrowLength (/ -1 WingLengthRatio)))
(set! theWingLength WingLengthRatio)
)
; define new brush for drawing operation
(gimp-brush-new brushName)
(gimp-brush-set-shape brushName BRUSH-GENERATED-CIRCLE) (gimp-brush-set-spikes brushName 2)
(gimp-brush-set-hardness brushName 1.00) (gimp-brush-set-aspect-ratio brushName 1.0)
(gimp-brush-set-angle brushName 0.0) (gimp-brush-set-spacing brushName 1.0)
; set radius of brush according to length of arrow
(if (< BrushThicknessOrRatio 0)
(gimp-brush-set-radius brushName (/ theArrowLength (* BrushThicknessOrRatio -1)))
(gimp-brush-set-radius brushName BrushThicknessOrRatio)
)
(gimp-context-set-brush brushName)
(if (or (= useFirstPointArrowAsHead 1) (= useDoubleHeadArrow 1))
(script-fu-help-1Arrow inPoint_1X inPoint_1Y inPoint_2X inPoint_2Y theWingLength (* (/ WingAngle 180) pi) drawable image FullHead MiddlePoint))
(if (or (= useFirstPointArrowAsHead 0) (= useDoubleHeadArrow 1))
(script-fu-help-1Arrow inPoint_2X inPoint_2Y inPoint_1X inPoint_1Y theWingLength (* (/ WingAngle 180) pi) drawable image FullHead MiddlePoint))
(gimp-context-set-brush oldBrushName)
(gimp-brush-delete brushName)
(if (= usePathThenRemove 1) (gimp-image-remove-vectors image theActiveVector))
(if (= useNewLayer 1) (begin
(plug-in-autocrop-layer TRUE image drawable)
(gimp-image-set-active-layer image oldLayer)
))
(gimp-displays-flush)
(gimp-image-undo-group-end image)
)(gimp-message "This script needs a path\nin order to position the head and the tail of the arrow (the first and last point of the path will be used)"))
) ; let*
); define
; Register the function with GIMP:
(script-fu-register "script-fu-draw-arrow"
_"_Arrow..."
_"Draw a nearly arbitrary arrow in your image"
"Berengar W. Lehr <B-Ranger@web.de>"
"2009, Berengar W. Lehr / MPG@IDIR, UH Jena, Germany."
"19th November 2009"
"*"
SF-IMAGE "The image" 0
SF-DRAWABLE "The drawable" 0
SF-ADJUSTMENT "Wing size [*] (= arrow length / X)" '(20 -100 500 10 1 1 1)
SF-ADJUSTMENT "Angle between the wings and the arrow, in degrees" '(25 5 85 5 15 0 0)
SF-TOGGLE "Filled arrowhead?" TRUE
SF-ADJUSTMENT "Thickness of the wings, as a percentage of their size\n(only if arrowhead is filled)" '(75 0 100 1 10 0 1)
SF-ADJUSTMENT "Line thickness [*] (= arrow length / X)" '(4 -500 500 1 10 0 1)
SF-TOGGLE "Use the first point of the path for the head?\n(if disabled, the last point will be taken)" FALSE
SF-TOGGLE "Remove the path after drawing?" FALSE
SF-TOGGLE "Use a new layer for the arrow?" TRUE
SF-TOGGLE "Create a double arrow?" FALSE
SF-TOGGLE "*) Positive values define an absolute dimension (in pixels),\nnegative values define relative values based on the total size of the arrow\n(checking or unchecking this box has no effect)" FALSE
)
(script-fu-menu-register "script-fu-draw-arrow" "<Image>/Tools/")
It's impossible that this thing only works on one computer... :-/
Luke.
-
-
Thank you, Luke1! I can't manage to take over the script, but it's good that you posted it online: maybe someone will have the means to both detect the errors and fix them! (generally, when you have one, you have the other... :-) )
When you mention that the script never worked, do you mean it produces nothing on your end, or that it creates messed up arrows like mine?
I also don’t understand how this thing can work on VIAGERS' computer and on none of the other participants in this thread! ... I remain (almost) convinced that there’s a parameter somewhere in GIMP that needs changing (a brush size that the script implies, for example, or something else!).
For now, since I need well-calibrated arrows, I'm making them elsewhere and importing them into GIMP (it's not very smart, but oh well... It's mainly longer than with a good integrated tool!). -
Good evening,
How can I make the file available?
The easiest way is to make it a ZIP archive (it's hard to share a text file alone whereas a ZIP can be shared everywhere) and upload it to a hosting service, then put the download link in a future message.
I use this address which works well and is totally free: https://www.fichier-zip.fr/
Luke.
--
The price of software is inversely proportional to its usability... ;-) -
-
Thank you, Viagers. But there must be a trick that I'm missing: I always get thick lines with your configuration; namely:
This has nothing to do with what you're presenting: however, I have the same issue on both of my GIMP 2.8 (the one on Windows and the one on Xubuntu); there must be another setting to specify somewhere to make the thickness correct! But which one?
It's frustrating to feel (to be) so damn clueless in front of a software! -
Hello,
Have you tried reinstalling it?
https://www.commentcamarche.net/faq/30547-creer-des-fleches-dans-gimp#utilisation
Aside from that, I don’t see...
Life annuities
--
Knowing where knowledge is also a form of knowledge..... -
Good evening,
Beautiful arrow brushes for Gimp
https://www.deviantart.com/ihea/art/VECTOR-ARROWS-HQ-44215503
--
"To achieve any change in our lives, we must begin by expressing gratitude for what we already possess." -
Re,
Gimp + Preferences. On the left, click on Folders + Brushes and on the right, you will see the path to your Gimp Brushes folder, where you need to place your downloaded brushes.
--
"To effect any change in our lives, we must start by expressing gratitude for what we already have."-
I know this has nothing to do with it, but here are some other nice brushes
https://www.deviantart.com/grindgod/art/Gimp-2-8-Color-Tubeset-for-Digital-Painters-380814984 -
-
-
Thank you, Y3X, for this info.
VIAGERS, I reset everything in the GIMP 2.8 settings by clicking on all the "Reset" buttons in the preferences. No improvement. Question: do you have the same version as me? Note: the tutorial seems to show version 1 of GIMP...EDIT
Really strange: here’s what I get with thickness 0 and thickness 1 (absurd!)
-
Hi Luke,
It works perfectly at my place, quite a strange story nonetheless
Best regards and friendships
Viagers
--
Knowing where knowledge is is also a form of knowledge.....-
Good evening Végé,
How are you?
One thing you could do would be to copy your script and make it available HERE for possible comparison and correction...
Still snowing?
Here it’s wet and it won’t be long before it overflows if it keeps going like this for another forty days and forty nights like the last time... :D
Best regards.
Luke.
-
-
-
Hello, VIAGERS.
Thank you for caring about my... troubles! :-)
I've found a temporary solution for now, while I wait to get my hands on the "tool" that works at the very heart of GIMP (which would be so much better). I'm using INKSCAPE (both on Windows and Xubuntu), which can make pretty good arrows; and, indeed, I import by copy-pasting... On the production side, it's very slow overall, but oh well...
import the image in Windows and insert - Shapes
That, however, I didn't understand... :-( -
-
Found another plugin that is not exactly "flexible" either, but provides satisfaction for making simple arrows:
arrow-designer, written in PYTHON: https://shallowsky.com/software/gimp/arrowdesigner/
On Windows 10, I placed it in the folder: C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins
For usage,
• choose the foreground color
• choose a brush and set it to the desired size (e.g.: 2px); this will correspond to the thickness of the arrow's stem
• make a rectangular selection in the image: this selection is crucial, as the arrow will be positioned on one of the sides of this selection, or on one of the diagonals (all positions are therefore possible: just make sure to correctly define your rectangular selection)
• go to FILTERS > RENDER > arrow from selection... Click
• set the arrowhead and direction (the arrow follows the manipulations as you go)
[ On Windows, I did not have to worry about GIMP-python: there is already a "python" module in the 'GIMP 2' folder on the hard drive! ] -
Hello.
I managed to contact the original designer of the 'arrow.scm' script, who provided me with a clean and fully functional script in English (several coders have improved it, according to him). I converted it to UTF8 (it was in ANSI) and attempted a translation into French of the relevant parts of the interface.
How can I make the file available? -
Hello,
I’m really glad to find this discussion. For my part, I was able to create arrows without any problem thanks to the CCM tutorial. I would like to create curved arrows. I know I need to use the path tool, but every time I end up with a straight arrow going from the first point to the last point as the second.
How can I create a curved arrow?
Thank you. -
Hello, Yoab.
To create short arrows, you need to make a... curve path first, then use the arrow.scm script (if available, access it through the TOOLS menu).
To make a curved path, use the "path creation" tool shaped like a fountain pen, place two points on the image by clicking in two different places, then hold down the left click (for example) in the middle of the sketched line on the screen and drag on either side of that line: immediately, the path curves.
STEP 1 (2 clicks + one dragged click)
STEP 2 (settings for the arrow)
STEP 3 (foreground color)
• Reminder: recent version in French of the script to download via the following address (the script works with Gimp2.10):
http://gimpfr.org/pub/scripts-2.8/Arrow/GIMP_arrow_fr.scm -
Good evening,
Yes, this script works very well and we can indeed provide the curves we want in the way explained:
The only requirements are to indicate that it is a curve (so that the head(s) are curved but it's not mandatory) and to specify if we want the head at the starting point or at the end or even at both ends....
Luke.
Good evening Piteur, how are you?
Have a great end of the evening. ;)
--
The price of software is inversely proportional to its usability... ;-) -
Hello,
I can manage to create curved paths... straight arrows...
but not curved arrows... The arrow is drawn in a straight line between the beginning and the end of my path.
Does anyone have an explanation? I should mention that I have Gimp 2.8.4... could that be the issue?
... Thank you
Cindy
- 1
- 2
Next



