If you'd like to upload plug-ins, please create an account below. Otherwise (e.g. for download or commenting) you do not need one! Enjoy :-)
Add a grid of guides from number of horizontal and vertical parts in GIMP.
Tested with GIMP 2.6
| Attachment | Size |
|---|---|
| guides-grid.scm | 1.26 KB |
Comments
Thanks Gigi!
I modified the script to work by specifying either the number of divisions (the current way) or by specifying the number of pixels for the guide spacing:
; Luigi Chiesa 2008. No copyright. Public Domain.
; Add a grid of guides
(define (script-fu-grid-guides InImage InHGrid InVGrid InMode InBorder)
(gimp-image-undo-group-start InImage)
(let* (
(width (car (gimp-image-width InImage)))
(height (car (gimp-image-height InImage)))
(divH (if (= InMode 0) (/ width InHGrid) InHGrid))
(divV (if (= InMode 0) (/ height InVGrid) InVGrid))
(InHGrid (if (= InMode 0) InHGrid (/ width InHGrid)))
(InVGrid (if (= InMode 0) InVGrid (/ height InVGrid)))
(hcount 1)
(vcount 1)
)
(if (= InBorder TRUE)
(begin
(gimp-image-add-hguide InImage 0)
(gimp-image-add-hguide InImage height)
(gimp-image-add-vguide InImage 0)
(gimp-image-add-vguide InImage width)
)
)
(while (< hcount InVGrid)
(gimp-image-add-hguide InImage (* divV hcount))
(set! hcount (+ hcount 1))
)
(while (< vcount InHGrid)
(gimp-image-add-vguide InImage (* divH vcount))
(set! vcount (+ vcount 1))
)
(gimp-image-undo-group-end InImage)
(gimp-displays-flush)
)
)
(script-fu-register
"script-fu-grid-guides"
"
"Add a grid of guides by specifying either the number of guides or the guide spacing"
"Luigi Chiesa and Rob Antonishen"
"Public Domain"
"November 2009"
"*"
SF-IMAGE "Image" 0
SF-ADJUSTMENT "Horizontal" '(2 1 500 1 10 0 1)
SF-ADJUSTMENT "Vertical" '(2 1 500 1 10 0 1)
SF-OPTION "Mode" '("Number of Divisions" "Spacing of Guides (px)")
SF-TOGGLE "Border guides?" FALSE
)
Is it possible...
I use this script a lot and truly appreciate having it, however, I was just wondering if it were possible to create a centering set of guidelines (one click option) that is based on any drawing size?
I have that same script in Paint Shop Pro written in Python.
Note sure what you mean by "centering"
I am not sure what you mean.
Would that not be the same as a 2 by 2 division grid, without edge grids?
-Rob A>
What I meant on centering
I have a script in Paint Shop Pro, that I created using Python, that places a vertical and horizontal guideline in the exact middle of any drawing I open, to help me find the center of that image, for using polar arrays, kaleidoscopes, or radial copy/duplications.
It would need to be a guideline, not a grid, and I only have to click once to get both guidelines. With the current guide script that you modified (thank you, btw) I have to click twice to get vertical, then horizontal. I was just wondering if there was a way to make it do both at the same time.
Don't think so
I don't think so. The script creates a grid of guidelines, both horizontal and vertical.
The modified script default gives what you are asking for:
Horizontal = 2
Vertical = 2
Mode = Number of Divisions
Border Guides unchecked.
This creates a pair of guides centered on the image.
-Rob A>
I modified a rules of third python script instead
I took Chris Mohler's "Rules of Thirds" py script and removed the thirds and modified it to halves. I had to re-register and re-name the script so as to not confuse GIMP.
This does what I want, but it still leaves me curious why the guides script can't have set guidelines hard coded into it instead of asking for user input. Or why not both, have it set the guidelines (like in my case) and have it asking for user input in other cases. Maybe it can, but I am just not asking in a way that makes sense.
Like in Rules of Thirds, there is no user input, the script just calculates the guidelines into thirds, both vertically and horizontally, and when clicked, applies the guidelines automatically to the image.
If anyone wants the modified "centered guidelines" python script, let me know, I'll post it.
nice!
If you are already using the ROT plug-in (it's installed), then you should rename the function as well - eg, replace both instances of "add_ROT_guides" with "add_center_guides" or similar. Doesn't really matter if you're not using ROT guides, but then again, that will look better in the Procedure Browser anyway...
Chris
Function was renamed, too.
I thought of that, wanting to retain the ROT option, so now both show up in the menu.
I can't thank you enough for this script.
Anything to reduce mouse clicks is a plus, for me. :)
Thank Gigi and RobA
Script was useful, even more useful with RobA added option
i like be able to set the spacing in pixels
But how to render the grid ?
i will like a option to render the grid on a new transparent layer,
OR a tip on how do manually
This because i often need diagonal OR oblique grid, if the grid is rendered on a transparent layer i may easy solve
1 enlarging image canvas
2 using the script
3 rotating the layer with the rendered grid as needed
4 cropping back to original size
but i can't easily render the grid on a new layer
This script does not create
This script does not create a grid on the image, it makes a grid of guidelines.
To draw a grid use the built in Filters>Render>Pattern>Grid
-Rob A>
thank Rob i forgot about
thank Rob i forgot about that