Gimp-Forum.net
Hexagonal grids - GIMP python plug-in - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+--- Thread: Hexagonal grids - GIMP python plug-in (/Thread-Hexagonal-grids-GIMP-python-plug-in)



Hexagonal grids - GIMP python plug-in - Scallact - 03-26-2023

Hi, I'm new to the forum.

This is my GIMP python script for the creation of hexagonal grids, with a "best fit" search algorithm for optimal rasterization.

Link to download:

http://graphie.org/ressources/gimp/plugins/pl_hexgrid_v07_20230326.zip


Some images:

http://graphie.org/ressources/gimp/plugins/pl_hexgrid_width30_01.png

http://graphie.org/ressources/gimp/plugins/pl_hexgrid_interface_01.png

http://graphie.org/ressources/gimp/plugins/pl_hexgrid_output_01.png


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.

I'd also like to recommend the excellent path-shaped-grid plugin by Ofnuts. My plugin is more specific to hexagons, and I tried not to duplicate the existing one's functionalities too much. I have done a few refinements that I hope will be useful, like image grid adjustment, and search for optimal parameters.

Enjoy!


RE: Hexagonal grids - GIMP python plug-in - PixLab - 03-26-2023

I would recommend that you put your website with https for your visitor to not have this:
[attachment=9604]

As my browser did not download, not even telling me, before I check out why it took so long to have nothing... Big Grin
They are free TLS certificate provider like https://letsencrypt.org/
this provider can even put a new certificate every 2-3 month automatically for you without bothering expiration, and it's free Wink

Having said that, nice plugin.

If I may, and if you could add this code
Code:
If (user>=input_Size_Bigger_Than_Canvas)
   user=moron
   foreach (user=moron as w&h)
   Canvas_Layer[w&h]=input_Size_Bigger_Than_Moron_Did
Just to increase the canvas/layer size even if user got only one hexagon.
Users are stupids, I'm stupid > I was toying around with your plugin and for sure without looking, I got a "plugin left GIMP in unstable blablabla", yeah I did input numbers bigger than the width or/and height of the canvas Angel
Big Grin


RE: Hexagonal grids - GIMP python plug-in - Scallact - 03-26-2023

Thanks for the feedback!
Yes I know, no https is bad Big Grin. My server needs some attention, and I don't have too much time right now.
I tried to download with Firefox and had no warning. What browser do you use?

Quote:Just to increase the canvas/layer size even if user got only one hexagon.
Users are stupids, I'm stupid > I was toying around with your plugin and for sure without looking, I got a "plugin left GIMP in unstable blablabla", yeah I did input numbers bigger than the width or/and height of the canvas

OK, the plugin should at least not crash in this case. I thought I had tested it. Will correct that for sure.
As for changing canvas size, I initially intended to do so, but gave up the idea, at least without user choice.


RE: Hexagonal grids - GIMP python plug-in - PixLab - 03-26-2023

I use Firefox as well, it did not warn me and did not download, I needed to click on the "Download progress" icon to see what was happening Wink


RE: Hexagonal grids - GIMP python plug-in - Krikor - 03-27-2023

Something I already needed a few months ago, a hexagonal grid.

But what I really wanted was to be able to create custom isometric grids using The Gimp. I always do this manually, but a plugin would save me a lot of time.

I don't know about this Ofnuts plugin (path-shaped-grid).
I researched and found that there is ofn-pixel-grid (which I didn't know either and I don't know what it's for).

Ps:

Searching better....
There is another page with another big collection of Ofnuts plugins and there I easily found this path-shaped-grid-00.

Thanks for the plugin and the plugin suggestion.


RE: Hexagonal grids - GIMP python plug-in - PixLab - 03-28-2023

(03-27-2023, 02:05 PM)Krikor Wrote: Something I already needed a few months ago, a hexagonal grid.

But what I really wanted was to be able to create custom isometric grids using The Gimp. I always do this manually, but a plugin would save me a lot of time.

Thanks for the plugin and the plugin suggestion.

How do you do your isometric grid? Please tell me that you are not following DMD...
I usually do it like this (for quick reference)  Filters > Distort > Mosaic , then rotate layer 90 degree (Layer >Transform > Rotate 90 > Done)

[attachment=9610]

And G'MIC allows for a lot more custom to distort your grid and get these special angles Wink

[attachment=9611]

For a path shaped grid like this...

[attachment=9612]

See path-shaped-grid

Unzip/extract the python file, put it in your Plugins folder, restart GIMP because it's a python, and It will be in Filters > Render > Paths > Shape Grid... Wink
Edit: I just see that's an Ofnuts script while looking inside the code, I might have changed the path in GIMP's menu long ago Big Grin


RE: Hexagonal grids - GIMP python plug-in - Ofnuts - 03-28-2023

(03-28-2023, 01:48 AM)PixLab Wrote: Unzip/extract the python file, put it in your Plugins folder, restart GIMP because it's a python, and It will be in Filters > Render > Paths > Shape Grid... Wink
Edit: I just see that's an Ofnuts script while looking inside the code, I might have changed the path in GIMP's menu long ago Big Grin

No you didn't, that script is indded in FIlters > Render.

But please remove your attachment:
  • People could mistake it for the one this thread is about
  • It would become obsolete if I update the version on SF



RE: Hexagonal grids - GIMP python plug-in - PixLab - 03-28-2023

(03-28-2023, 07:36 AM)Ofnuts Wrote:
(03-28-2023, 01:48 AM)PixLab Wrote: Unzip/extract the python file, put it in your Plugins folder, restart GIMP because it's a python, and It will be in Filters > Render > Paths > Shape Grid... Wink
Edit: I just see that's an Ofnuts script while looking inside the code, I might have changed the path in GIMP's menu long ago Big Grin

No you didn't, that script is indded in FIlters > Render.

But please remove your attachment:
  • People could mistake it for the one this thread is about
  • It would become obsolete if I update the version on SF

I can't... you(Admins) replaced the "Edit" with "Delete".

If I recall above a number of posts we could continue to "Edit" after a while, but now it's "Delete",
"Edit" is better IMHO as we can update a post to latest "technique" for example, on the other hand "Delete" is just getting empty a maybe useful post  Big Grin

[attachment=9614]

In all case feel free to remove the sentence with the link (Here you go + link etc..) .
What id fun is > I just saw that I can "Report" myself (I never paid attention)... Big Grin


RE: Hexagonal grids - GIMP python plug-in - Krikor - 03-28-2023

(03-28-2023, 01:48 AM)PixLab Wrote:
(03-27-2023, 02:05 PM)Krikor Wrote: Something I already needed a few months ago, a hexagonal grid.

But what I really wanted was to be able to create custom isometric grids using The Gimp. I always do this manually, but a plugin would save me a lot of time.

Thanks for the plugin and the plugin suggestion.

How do you do your isometric grid? Please tell me that you are not following DMD...
I usually do it like this (for quick reference)  Filters > Distort > Mosaic , then rotate layer 90 degree (Layer >Transform > Rotate 90 > Done)

And G'MIC allows for a lot more custom to distort your grid and get these special angles Wink

For a path shaped grid like this...

Here you go

Unzip/extract the python file, put it in your Plugins folder, restart GIMP because it's a python, and It will be in Filters > Render > Paths > Shape Grid... Wink
Edit: I just see that's an Ofnuts script while looking inside the code, I might have changed the path in GIMP's menu long ago Big Grin

PixLab,

I remember watching DMD's video a long time ago, but I don't remember what process he used in the video anymore.

In fact, I don't even remember exactly how I made my isometric grids in Gimp at the time.

I remember that one of the techniques I used was basically using the inbetweener plugin (I think that's how it's spelled - too lazy to go check it out) from Ofnuts.

I create a path, rotate it by 30º and duplicate it.
I calculate the exact point at which each path should be far from one another and knowing how many paths there should be between them, I use the Inbetweener plugin to generate the intermediate paths.
Then I group these paths, duplicate them, flip vertically, etc.
Definitely not the best or easiest way to create these grids... but it worked.
[attachment=9616]
The good thing about this is that I only had to do this once, so I saved it as xcf and used it whenever I needed to create a new one. (attached)

Yesterday, when reading post #1, I went looking for the path-shaped-grid plugin, and I tried to download it... but I couldn't!
It turns out that I already had this plugin (since March 2020) and I didn't even remember, it was only when I read the message about overwriting the plugin that I realized my mistake.

Playing around with the plugin I soon discovered that setting Shape = Triangular; Size = 70; Direction = Vertical basically produced what I wanted!

I would never imagine using the Mosaic filter to get an isometric grid, at least I never tried it. Undoubtedly an interesting option.

G'MIC is an option that I use less and less, so I have little familiarity with the millions of filters in it. Basically, I almost always use the same filters (some dozens of them).
The Grid[Triangular] filter is another nice option, too bad it doesn't generate a path, nor does it give you the option of the desired thickness.

With Gimp I use the isometric grid as a reference, to facilitate the positioning of the arts. But it's with Inkscape that I really work on creating the elements on the isometric plane.

Thanks for the super tips!


RE: Hexagonal grids - GIMP python plug-in - Ofnuts - 03-28-2023

(03-28-2023, 09:32 AM)PixLab Wrote: In all case feel free to remove the sentence with the link (Here you go + link etc..) .
What id fun is > I just saw that I can "Report" myself (I never paid attention)... Big Grin

OK, done