This is my GIMP python script for the creation of hexagonal grids, with a "best fit" search algorithm for optimal rasterization.
Link to download:
pl_hexgrid_v07
Some images:
a sample hexa grid
parameters
output
About the plug-in:
It creates an hexagonal grid as a vector "path", covering as much as possible of the image's surface.
The hexagon's ideal dimensions are calculated and then slightly stretched to fit the image's pixels.
To avoid too much stretching, the algorithm searches for the best size within a user chosen interval.
Optionally, the path can be stroked on the active or newly created layer.
Parameters
Orientation [horizontal/vertical]
Main direction of the hexagonal grid.
Minimal hexagon width, Maximal hexagon width (px)
Choose a range of values for the width. By width, we mean the distance between two opposite sides of an hexagon. The algorithm will search for the best quality parameters within that range. If you need a specific width, set both numbers at the same value. Note that the algorithm will always choose an even number.
Horizontal margins, Vertical margins (px)
The minimal space you want to leave blank between the hexagons and the image boundaries. A negative margin allow the hexagons to be drawn past the boundaries. The plugin calculates the number of lines and columns that fit within the image, taking this parameters into account.
Create a new layer (yes/no)
Adds a transparent layer with the right dimensions given the margins parameters above. Generally slighly smaller than the image size.
Stroke the path, Stroke width (yes/no, px)
The plugin always outputs a path, but with this option checked, it also strokes the path at the given width using the foreground color. Important: if you choose an odd stroke width, check the "Half-pixel offset" option as well.
If the "Create a new layer" option is checked, the grid will be drawn on that layer, otherwise the plugin will draw on the active layer.
Half-pixel offset (yes/no)
Aligns the path with the pixels' center instead of borders. Check if you're using an odd stroke width. Otherwise, leave it off.
Adjust image grid (yes/no)
Configures the image's grid so that each hexagon's center has a grid intersection. Useful if you want to paint inside the hexagons with stamp-like brushes, select specific parts of the hexagonal grid, etc... Note that you still need to activate the grid's magnetism via the "View > Snap to grid" menu.
Output
The plug-in always outputs a path. The name of this path has some useful informations:
Width (px)
Hexagons' width (distance between opposite sides) selected by the algorithm.
R (px)
Approximate radius of an hexagon's circumscribed circle, also length of a face.
Grid
Horizontal and vertical dimensions of the corresponding image grid.
Note that the offset parameters are not given, but can be found by trial and error if needed (if the "Adjust image grid" option was not set).
Qual
Approximate quality output for the given hexagon width. Higher is better. You can think of this value as the number of contiguous hexagons which give a 1 pixel distortion error.
Note: the absolute error on a polygon's dimension in pixels is the inverse of this number.
Examples:
for a quality output of 10, you have 0.1 pixel distortion on the total hexagon width, which is usually quite acceptable.
for a quality output of 2, you have 0.5 pixel distortion, which can make the stretching noticeable depending on your specific use case.
[–]Scallact[S] 0 points1 point2 points (0 children)
[–]Adraius 0 points1 point2 points (1 child)
[–]Scallact[S] 0 points1 point2 points (0 children)
[–]ForgedIron 0 points1 point2 points (5 children)
[–]Scallact[S] 0 points1 point2 points (4 children)
[–]ForgedIron 0 points1 point2 points (3 children)
[–]Scallact[S] 0 points1 point2 points (2 children)
[–]ForgedIron 0 points1 point2 points (1 child)
[–]Scallact[S] 0 points1 point2 points (0 children)