The Big Bad G'MIC Thread of Silly Questions

Wouldn’t it be easier to code by doing the colors first, then assemble them?

Don’t know if I said this before, but you went with a big jump by going 3D. 3D is something I’d like to explore more in G’MIC myself.

Which makes me wonder, any goal in mind?

That’s what I did ( look at the castle part above).
I made a repeat loop to add each box with a different color each time.
But right now I’m trying to mod array_3d to add variation ( coords, rotation, size, color…what else?) but it’s not ideal since it assembles all objects after each x,y,z duplication. So I end up with lines of objects of the alternate color, etc. I had to modify it a lot and now it just look like my previous loop lol. But it works, just have to add the params. For example, you could just use it to spawn a whole patch of 3d grass or stones that way.

Build a procedural castle. Then a kingdom? At least the exterior. Then, if I use a seed, it can be explored in gmic_qt? Still, I have to learn how to use these triangles and quads to model basic stuff like arches etc. I could just use boxes though, will just look uglier.

It’s fun, join me? :wink:

When I get to doing 3D fractal, I’ll definitely join you there. Xenodreams clone seems doable in G’MIC.

Never really explored fractals before, due to my lack of math braincells.

But i got a bunch of random one liners yesterday which have nothing to do with fractals heh:


Front

Another Angle

A fluffy

1 Like

@prawnsushi …Is pr_underwoods a GUI only filter, I tried it in the cli but I just get a fuzzy effect, which is quite nice but nothing like the results posted here?!..

It is a GUI only filter. It can be turned into CLI filter, but he would have to spend time doing cli code. In my experience, that means double the amount of work.

Ok thanks, having no recourse to a GUI version it looks as if that particular filter is off the cards for now.
With my limited knowledge of coding in gmic (practically zero) I would have thought the GUI filter would be more advanced than a version for the CLI, as there are more graphical considerations etc… but yeah, I have limited knowledge.
Anyway, appreciate the input as always!

Hello @Mushy .
In G’MIC, there are indeed some filters that are designed specifically for the G’MIC-Qt interface,
but any such filter is still available using the command line tool gmic.

To know the command, just use the “Copy command to clipboard” button from the G’MIC-Qt interface :

Then, if you paste the content of the clipboard somewhere, you’ll get the command name with its parameters, in my example :

pr_underwoods 0,30,50,5,10,10,0.7,208,208,156,34,500,1,255,255,255,0.4,0,0,10,4,2,0.4,0,20,15,10,0,1,15,10,0,0.8,100,0,0,40,30,0,40,20,0,20,10,0,0,0,0,0.2,34,0

Now, to apply this on an image from the command line, just embed the command above with the traditional input/output stuffs :

$ gmic input.jpg pr_underwoods 0,30,50,5,10,10,0.7,208,208,156,34,500,1,255,255,255,0.4,0,0,10,4,2,0.4,0,20,15,10,0,1,15,10,0,0.8,100,0,0,40,30,0,40,20,0,20,10,0,0,0,0,0.2,34,0 -o output.jpg

Et voilà!

If that does not work for you, it’s probably because your versions of gmic and G'MIC-Qt are different.

Alas, i saw this a bit late. I’ve just upgraded to fedora 41 and now i have gimp 3RC1, without gmic-qt. doh.
EDIT : so i compiled gmic 3.5pre and it works with gimp 3.0RC1 now. Cool.

@Mushy Thanks for your interest! You can effectively use the filter in the command line just like @David_Tschumperle said. I don’t think it’ll be very practical to use a full CLI version as you wouldn’t see what happens to your image, and there are many parameters.

There is also another version hidden in Testing > Prawnsushi > Nonscape - Woods. This one has even more parameters.

 pr_nonwoods 0,50,1920,1080,80,5,3,3,0.2,255,255,255,34,1500,1,255,255,255,0.8,0,0,10,0,4,2,0,0,40,50,0,24,16,0,1,0,23,0,1,38,76,56,20,3,0.12,8,10,20,10,10,0,46,67,0,124,182,255,255,255,0,169,200,0,85,127,0.4,19,0,0

Yeah more numbers!

It would be quite nightmarish to use this from the CLI, but it would be useful if you want to randomize it with a script.
Perhaps i should write some help files for these when i get some time…? I’m quite dead to be honest.

It’s possible to automate the process of convert GUI element into CLI description, which then can help you rewrite as a CLI script. On the first part, I highly recommend Python, and there’s always this repository - GitHub - Reptorian1125/GMIC-editing-python-script-repository: Repository for Python scripts which is to be used for scripting in the G'MIC language .

It is possible to create an interactive filter for CLI. I have made a few albeit dead-simple ones. Also, if one only needs access to or change a few of the filter’s parameters, one can make a new filter that sets the rest as constants.

Hello @prawnsushi , I’m actually interested by this.
I’ve been able to compile the plug-in myself on Windows for GIMP 3.0, but never succeeded in making it appear when I launch GIMP.
So I’ve not tested it since I’ve done the modification in the source code (with the great help of @samj ). Not sure if all is working as expected.
Any feedback would be appreciated!

Sorry, i never got to reply to this, i was really sick for 2 weeks after that… Anyway i didn’t do anything special, just built from pre-release source and put the file in the GIMP 3.0 plugin folder, it just worked.

On another note, can someone help me reorganize this eval script? I’ve added 2 more “filled” options to stringify, but I’m really not familiar with the syntax here. I just want to put this in a logical order (see all these $link==5,1,2,4,3…). 5,4,3,2,1 should be more readable.

Mod:

#@gui : Link = ~choice(2,"2 points","3 points","3 points filled","4 points","4 points filled","All points")

        eval[$p] ":begin(color = [ "$color" ]; const offset = h/($link + 2)*$offset%; ret = I);
          P = I;
          $link==5?(repeat (h,k,polygon(#2,2,P,I[k],$opacity%,color))):( # All-points link
            Q = J[offset,2];
            !$link?polygon(#2,2,P,Q,$opacity%,color):( # 2-point link
              R = J[2*offset,2];
              $link==1?polygon(#2,-3,P,Q,R,$opacity%,0xFFFFFFFF,color):( # 3-points link
                $link==2?polygon(#2,3,P,Q,R,$opacity%,color):( # 3-points link filled
                  S = J[3*offset,2];
                    $link==4?polygon(#2,4,P,Q,R,S,$opacity%,color):( # 4-points link filled
                      $link==3?polygon(#2,-4,P,R,Q,S,$opacity%,0xFFFFFFFF,color) # 4-points link
                  );
                );
              );
            );
          ); ret"

Original stringify :

        eval[$p] ":begin(color = [ "$color" ]; const offset = h/($link + 2)*$offset%; ret = I);
          P = I;
          $link==3?(repeat (h,k,polygon(#2,2,P,I[k],$opacity%,color))):( # All-points link
            Q = J[offset,2];
            !$link?polygon(#2,2,P,Q,$opacity%,color):( # 2-point link
              R = J[2*offset,2];
              $link==1?polygon(#2,-3,P,Q,R,$opacity%,0xFFFFFFFF,color):( # 3-points link
                S = J[3*offset,2]; polygon(#2,-4,P,R,Q,S,$opacity%,0xFFFFFFFF,color) # 4-points link
              );
            );
          ); ret"

And BTW, i have a little bug probably linked to wayland:
When i use the display command from gmic_gimp_qt (from Gimp 3.0.0RC2) , it says “no display available”.
But display works fine from gmic_qt standalone or gmic. Not sure what’s happening there.
Thanks.

I don’t know if this code works, but I tried to simplify your code with more options:

eval[$p] ":begin(
		const link=link;
		const offset_step = h/(link + 2)*$offset%; 
		const max_num_of_links=5;
		const dec_max_num_of_links=max_num_of_links-1;
		const coordinates_vector_size=(link+2)<<1;
		const is_filled=$is_filled; # Yes, you need a fill variable here.
		color = [ "$color" ]; 
		initial_coordinates=vector(#coordinates_vector_size);
		if(is_filled
		,create_polygon()=polygon(#2,3,coordinates,$opacity%,color);
		,create_polygon()=polygon(#2,-3,coordinates,$opacity%,0xFFFFFFFF,color);
		);
		ret = I;
	);
	P = I;
	link==max_num_of_links?(
		repeat(h,k,
			polygon(#2,2,P,I[k],$opacity%,color);
		);
	):(
		offset=offset_step;
		coordinates=initial_coordinates;
		for(p=0,p<coordinates_vector_size,p+=2,
			copy(coordinates[p],J[offset,2],2,1,1);
			offset+=offset_step;
		);
		create_polygon();
	);
	ret;"

@prawnsushi Also, wanted to leave a tip. On KDE Kate, I would highly recommend to use tabs, and yes, you can see tabs too.

On the bottom-right, set indentation mode to tabulator, press tab to let KDE Kate autoformat to tab, then you can have adjustable tab size. This will eliminate the need to use single space to save space, and add to readability. You can adjust space to see more or less separation of blocks. Sometimes, I use 1 or 2 or 4 or 8 depending on how much separation I want.

Thanks for the effort, but your code doesn’t seem to work. It’s stuck at link=link.
Anyway, my little mod works so i’ll leave it like this for the time being.
I can always change it later when i’ve figured out all these parentheses.

Thanks for the tab tip, looks useful :slight_smile: For some reason i never really explored text editors functions…

Sorry, it was supposed to be link=$link. I couldn’t test it, so I couldn’t saw that.

@Reptorian I wonder how you can write this kind of code without even seeing what it does :open_mouth: I don’t think i can.

So here’s a few outputs of the mod (Original photograph here) :




I doubt it’ll be useful to anyone though… :stuck_out_tongue:

1 Like

The first one is cool!

Thanks, 1st one is with the default (modded) settings.

I have a little question about alpha. For seamless chaotic pattern i have to alpha blend all layers to make the gui preview, but doing so i noticed that the colors are quite different (darker, almost black sometimes ) than the resulting layers in gimp, which are brighter. Is there a way to fix this so i have an exact preview?
I tried splitting channels and playing with the alpha channels but it’s still different.

image
image

Edit : OK, so i removed the randomized opacity values and set them to 255, for all drawn objects, and it looks better. A bit sad though since it’s less nuanced, but nvm.