Anyway, I thought it would be useful if I could tell GIMP to use current selection as area for setting guides.
There is an option called New guide from selection (Images -> Guides -> New guide from selection), but this just
puts 2 horizontal and 2 vertical guides along sides of selection.
What I had in mind was to use current rectangular selection (or bounding box of it) and then "divide" it into equal parts by
setting guides (number settable by user), either horizontally, vertically, or both.
So for example, let's say I have some kind of object on my canvas, and it's already placed on the right spot.
And maybe I want to do some work on the middle third.
I could use measure tool, but this won't work without calculator.
Another option would be using rectangular selection and then setting Rule of thirds under tool options.
But choosing any tool after that results in "guides" vanishing inside of the selection, so you have to put guides
manually right after making that selection, if you don't want to loose them.
Also, if you need any number of divisions that's not already predefined (center, thirds, fifths...) this technique will not really work.
It can be done, but it will definitely take lots of repetitive steps.
So I wrote a small plugin that does exactly what I had in mind.
It's not finished yet, but it works.
So how do you use it? After placing it in plugin directory, it registers itself under Image -> Guides -> Divide selection using guides
First you make a selection. It doesn't have to be rectangular, and if it's not it will use the bounding box of the selection
for calculation. After making a selection, choose Divide selection using guides (under Image -> Guides).
Enter the number of divisions you need, and that's it.
Now, maybe I'm re-discovering here something that's common knowledge among gimpers,
but even if that's the case, this was a good learning experience. The only problem is I'm
getting lots of GEGL related errors (GIMP 2.10.32), but from what I could read here, it's not my plugin's fault.
04-14-2023, 02:11 PM (This post was last modified: 04-14-2023, 02:14 PM by PixLab.)
I'm laughing right now, not about you, let me explain.
I start to read your post, and reaching something like 2/3 of it, I told myself "This guy/gal looks like s/he knows what s/he is speaking about, with all example the s/he gave, what's her/his problem?"
Then I came to the last 3rd part of your comment and understood you were proposing a plugin, that why I'm laughing > misunderstanding your post
In all case thanks a lot for it I'll try it tomorrow (it's very late evening in my time zone), and I'm thinking already for some useful use, for sure your plugin will be useful.
Again thank you very much, please have a fantastic day/evening or night.
(04-14-2023, 02:11 PM)PixLab Wrote: I'm laughing right now, not about you, let me explain.
I start to read your post, and reaching something like 2/3 of it, I told myself "This guy/gal looks like s/he knows what s/he is speaking about, with all example the s/he gave, what's her/his problem?"
Well one reason I went into details is to get some feedback - is there anything else out there, how other people deal with this...? It was like, if they don't use the measure tool in combination with calculator on their phone, what do they use?
Another was to convince myself that I'm not missing anything important. And that is the hard part,
GIMP's UI is pretty complex, not always the most intuitive (well *of course* layer name in bold means there is no alpha channel and on top of that - AFAIK, there is no single repository of useful scripts, so lots of useful stuff is probably scattered around.
So when I saw Ofnuts repository, I thought somebody with more experience must have already thought of this "divide selection with guides" problem.
Especially when I realized it wasn't really that hard to write (after initial hurdle) - at least this basic version.
So, I don't know - maybe I missed it, maybe there are other more effective solutions out there, maybe even in the GIMP itself, but I couldn't really find anything.
Don't expect too much, it's quite basic really. But I think it could be useful.
(04-14-2023, 09:33 AM)goran Wrote: I could use measure tool, but this won't work without calculator.
Well maybe yes... In the input fields where Gimp expects a number, you can enter expressions. For instance, to scale a 4000px image to half, instead of computing 2000 on the side, you just enter 4000/2 in the size field (and since it already contains 4000, you just add /2).
04-15-2023, 04:02 AM (This post was last modified: 04-15-2023, 04:28 AM by PixLab.)
(04-14-2023, 04:46 PM)Ofnuts Wrote:
(04-14-2023, 09:33 AM)goran Wrote: I could use measure tool, but this won't work without calculator.
Well maybe yes... In the input fields where Gimp expects a number, you can enter expressions. For instance, to scale a 4000px image to half, instead of computing 2000 on the side, you just enter 4000/2 in the size field (and since it already contains 4000, you just add /2).
I never saw an input field on the measurement tool, OP and I are speaking about this tool >
(04-14-2023, 04:20 PM)goran Wrote: Don't expect too much, it's quite basic really. But I think it could be useful.
I did tried today, nice and indeed it will be useful.
Two things though, would it be possible to change the PF_INT to something like PF_SPINNER ?
I took the freedom to slightly add 2 code lines to be able to do a Ctrl+Z at once and not have to do it multiple time (I'm no programmer, I hope it's ok)
Here:
(04-15-2023, 04:02 AM)PixLab Wrote: I did tried today, nice and indeed it will be useful.
Two things though, would it be possible to change the PF_INT to something like PF_SPINNER ?
I took the freedom to slightly add 2 code lines to be able to do a Ctrl+Z at once and not have to do it multiple time (I'm no programmer, I hope it's ok)
Well I'm also new to this, but yes, from what I read PF_SPINNER requires additional argument.
it's a tuple in the form of (min, max, step). So if you change these two lines:
You can use the above one line to replace the following lines you currently have (changing non_empty and image to your preferred variable names) as there is no need for the multiple calls:
(04-15-2023, 11:01 AM)goran Wrote: So you'll also have to cast the values, you can just put these two lines
in the beginning of the function (def line is the same as it was):