afre's G'MIC diary

That is a compliment. It would be great if you could link to my user page, as shown in the image above and post here so that I could keep track. Thanks.


Another person (@Iain) expressed interest in afre_edge. Since this is a diary, I have some personal (and vulnerable) thoughts on the matter.


Reflection

The code is already up and running. It should be self-explanatory but let me know if you have any specific questions.

The real test of a command, filter or, more abstractly, an idea is that people use it, hopefully with proper attribution. I would encourage you to use the command itself and not simply replicate it because I came up with it myself, expending time, energy and imagination into it. If it is not satisfactory for your uses, I would prefer that we brainstorm or collaborate to make it better together. That way we can learn from one another.

I am brimming with ideas but don’t usually have the tools or resources to realize them. Thanks to this community and those behind it (in particular, @patdavid and @David_Tschumperle), I have gone from knowing nothing to knowing something and being able to actively help our forum members and visitors. If you answer my questions, give feedback or use my commands, that would help me be much more productive.

A deeper and darker reason for this line of thinking is that, for almost all of my life, people have taken advantage and taken credit for my work. So much so that it is as if I didn’t exist or I were a hindrance. I get nothing in return, or worse: lost time, wages or straight up abuse. It is very painful living like that, impoverished and without anyone to have my back (for real).

Which is why I try to be of good cheer in this forum and in the code with these (^_^) (>_<). And so some attribution, encouragement and / or collaboration would help keep me going.

6 Likes

Thanks @afre for all your efforts.

I know that developing G’MIC scripts is not always an easy task, and you have always held on to it, thank you, on behalf of the entire user community!

6 Likes

Thanks. Was feeling a way low yesterday.

1 Like

Hello @afre

I do think you are an extremely talented person.
For sure, your help on this forum is quite appreciated!

If I may crack a joke, just only for being able to code proficiently with the “G’MIC programming language” makes you a super star! :slight_smile: :slight_smile:

4 Likes

I really appreciate you letting us know what you’ve been thinking. I look up to people like you when it comes to GMIC filters. You certainly know a lot about the stuff I don’t know much about. :grinning:

I would encourage you to use the command itself and not simply replicate it because I came up with it myself, expending time, energy and imagination into it. If it is not satisfactory for your uses, I would prefer that we brainstorm or collaborate to make it better together. That way we can learn from one another.

I like this approach a lot.

3 Likes

Au contraire, mes ami: here, you are valued. From my perch, you and @Morgan_Hardwood do more than any other members to keep us on track in these threads. I personally sit up and listen carefully to what you have to say; I haven’t much pitched in to some of the conversations due to multitasking, but that’s changing as I put the day job on the back burner.

One thing on my to-do list is to more completely understand G’MIC programming. Programming languages were my academic focus, but I have to admit G’MIC vexes me. Your proficiency in it is well-regarded, at my desk…

Open-Source thinking is a bit of a glitch in our market economy: exchange of ideas doesn’t necessarily put food on the table, or as you point out, directly instill a sense of accomplishment in the contributor. Even with all the ‘conversation’ taking place here, you can bet we’re all reticent to spill our guts here when we don’t know who will respond mis-understandingly.

@afre, I most definitely value your contributions here.

5 Likes

It took me a year on G’MIC programming, and I still have a lot of questions about doing it. And then there’s unsolved one like this one - Anything to autoconnect points within G'MIC? . I don’t get that much praises on what I do, but I still do it because I definitely want to offer fun filters found on Paint.NET forums and obscure sources to G’MIC. @afre did helped me significantly as well as @David_Tschumperle, but the only way to learn G’MIC programming is to just do it. You’re never going to learn programming/scripting otherwise.

1 Like

The legend of the learning difficulty of the G’MIC language is on the move…

It’s a simple language! :slight_smile:

1 Like

@ggbutcher the feelings are very much mutual - I pay attention to and learn from your insights which I value for the fact that you explain things you’ve actually tested and verified through your coding, and enjoy your thorough and patient style of response.

@afre I find that walking away from the computer and into the woods helps when I’m feeling similar to how you felt.

3 Likes

Being here is like walking in the woods for me. I agree that it would be healthier for me to walk in the actual woods every so often (without bringing Mr Shakes with me; he is a good boy but demanding).

1 Like

I am reminded of a short joke, goes like this: Two guys, sitting next to each other on a train. Guy at the window: 132. (time passes…) 78. (more time…) 254… Guy on the aisle: What are you doing? Window Guy: Counting cows. Aisle Guy: Wow! We’re going at least 70 (MPH, KPH, go with what you’re familiar), how do you do that? Window Guy: Easy. I just count the number of legs and divide by four…

I think interpolation resizing is a lot like that. :smile:

2 Likes

I know this is a little too much to ask for, but I would like to see more details on filters as in information about them. When I do filters, I add info myself.

It’s a simple language!

I agree that it’s the best language for image processing, and it is the bridge for software independence i.e you don’t have to use one software to use x filter or another.

Behind the command Problem solving and determining the viability of a (null) hypothesis is a labour of love or necessity. We all do it at some capacity, whether formally or informally, by brilliance or stumbling in the dark. Mastery is achieved when you have that moment of clarity – call it being in the zone, making a discovery or having a revelation.

I will explain afre_edge since @Iain asked. The concept is dead simple and it embodies the distilling of mastery that I just waxed poetic. I like dead simple because it means that even I can understand it comfortably and the resultant command is guaranteed to be fast, even on the saddest laptop (mine).

Observe the following command.

gmic 51,51,1,1 f x==25?255 o line.png repeat 2 gradient_norm done o gradient_norm.png

A picture, or two, is worth a thousand words. The second is normalized for your viewing pleasure.

line gradient_norm

Subtract the first from the second. afre_edge in a nutshell. :exploding_head: :coconut:


For context, what gradient_norm does to lines is double around them, leaving a void where they were, which is awkward for edge detection but exploitable for afre_edge. The gradient_norm by itself does this (normalized)

As you can observe, lines such as whiskers “double up” when a good detector should keep the line.

More commentary on attribution

Sometimes it makes complete sense, not just out of obligation but also out of respect and appreciation. It is a shame that some people don’t do it.

Others times it can be mundane because it is generally accepted (one cannot copyright vocabulary) or a parallel work (attribution is unnecessary, though a referral would help contextualize the problem). I feel that these two cases cover lots of what I do. Still, it might be necessary in order to avoid being accused of plagiarism or copyright infraction, which can utterly destroy you in an academic or corporate setting (of which I am not a part, thankfully).

Inspiration is a greyer area. In most cases it is illogical: it doesn’t have to have anything to do with the outcome. Regardless of the source it can do one a great service if it helps one achieve his or her goals. That said, we want to ask What were his or her influences? I find that such characterizations are decided by the critics and historians, either fairly or unfairly depending on who you ask. A photographer can create an original work but that doesn’t mean that the work has no relation to other creators or works.

1 Like

That’s really smart. :nerd_face:

You won’t believe how complicated I can make thinning edges.

I find that rolling up my sleeves and blocking out the noise helps me develop a better (as in simpler and faster) command than the algorithms from my reading list. In fact I have always done life that way and though it is the harder path it is more rewarding in my perspective but not someone looking in.

Update

A. Remember that all new changes require G’MIC 2.8.x and my commands don’t factor in alpha or CMYK (CMYKA). As a result, they may misbehave in GUI apps where layers contain an alpha channel.

B. afre_orien is finally retrievable via gmic update. It is the counterpart to afre_y50, as orientation is to norm, which is to say that it is the colour component.

C. afre_softlight CLI GUI is in a PR and should be retrievable soon. It is invertible and adaptable. I will explain below. Take this example:

gmic sp tiger +afre_softlight 0 +afre_softlight[0,1] 1,1 rm..

1 Since there is only one layer, the image will blend itself.

2 First parameter is inverse={ 0 | 1 }; second is reverse_order={ 0 | 1 }. If we do a normal soft light blend of tiger and then use the original tiger to inverse blend, you get the original tiger back, short of some rounding errors. PS an invertible soft light is much slower than the stdlib one because it uses 2 power operations.

Take this next example:

gmic sp boats,chick,david +afre_softlight 0 +afre_softlight[0,1] 0,1 rm[3]

3 Since boats is grey scale while chick is RGB, the output will inherit the one with the most channels, which would be RGB. This shall be limited to GA, RGB, RGBA only.

4 The x and y axes are also unmatching. To prevent image edges from showing, the blending layer will be zoomed in or out so that the original layer will fit inside of it. Since salient content is almost always near the centre, the blending layer will also be centred w.r.t. the original.

5 The command takes a minimalist approach to indexing. It allows the user to select any number of images but will only blend the last two on the list. Since G’MIC orders its selections, a convenience parameter reverse_order has been included.

6 The blending is normalized and respects the base layer’s range. This means that the effect is spread out to all of the tones.

7 Issues GUI:
a The plugin preview doesn’t align the input layers properly after the resizing and repositioning of the blending layer. A workaround to this to Reset Zoom once in a while.
b At least in GIMP, after committing the change, the canvas is cropped at the right and bottom edges. Ideally, I would want no crop to occur and to have the resultant image centred on the canvas.

Suggestions on 7a and 7b are welcome.

PS 7a is explained in Release of G'MIC 2.8 - #15 by afre and 7b below.

On 7b, that’s why I suggested a official new command called oisc which stands for original image size command. The parameters goes on the line of oisc “”,[copied from resize]. And it would resize all images to their original size. The part between quotation is your command.

Let me explain 7b in more detail. If I blend david.png with chick.png, the output inherits the size of the base layer david.png. When I select new layer, it works as expected. See top thumbnail on the right panel: we can see a full alpha border.

If I do an in-place output, however, the alpha gets cropped on the right and the bottom.

In my opinion, the GIMP canvas shouldn’t change when the in-place output option is selected. If cropping is necessary, I would rather invoke the Fit Canvas to Layers command. In CLI, we wouldn’t have this problem because a canvas doesn’t exist. In-place and insertion result in the same output since each image in the list is separate.

PS ImageMagick does have a virtual canvas and its repage option can reset it. Perhaps we can do something similar in the plugin to manage the canvas in the GUI editor.

It’s a interesting idea to have g’mic downside canvas. In Krita or GIMP, upsizing is possible. In Paint.NET, not possible.