G'MIC fun with Reptorian

I even reached out to Python programmers, and it seems that my code is correct. So, this tells me, something’s going on. There was a Python programmer here that quits on G’MIC-Py (Something I"d like) or maybe having G’MIC on Julia would be easier.

EDIT:

Hypothesis after testing mesh-grid and i. I ruled out those. I’m left with overflow on Python numpy explanation. Both powermod() and modpower() of ours avoid overflow.

Google points to it too:

And, I tested this:

C:\Windows\System32>gmic echo {100"^"8%(1"<<"32)}
[gmic]./ Start G'MIC interpreter (v.3.3.4).
1874919424
[gmic]./ End G'MIC interpreter.

Proving the problem is within numpy lack of support toward big integers.

But sadly, despite knowing this is a overflow trick, I don’t think I can do it for G’MIC.

1 Like

Testing the overwrite on the OOBS filter:

3 Likes

A little fun with the improved code I made this morning:

3 Likes

Thorn Fractal again. Somehow made it beautiful via autolevel in Paint.NET.

4 Likes

Just some fun with rep_mode_blend.

$ sp colorful +mirror x +mirror y +rotate 90 tic rep_mode_blend toc +channels. 0 "|". 1 lt. 1 inpaint_pde[-2] [-1] rm.

Which makes me wish I had isinf and isnan as a command.

2 Likes
1 Like

Thanks.

I know, I been asking for too much recently. And I now have another idea.

$ (1,2,3) echo {sum(#-1)}

This is not possible, but this seems useful in case you want to have variable-size arguments within math evaluator given that resize and other things allows for that. Imagine all the other variadic arguments gets this option, including custom ones.

Why not:

echo {is#-1}

?

Well, that wouldn’t work with lcm(), which I have some ideas for. Particularly, circular generative art. But, I guess I can just use a loop and resize() to solve that.

Basically, you may want to use crop(#ind) in those cases:

e {lcm(crop(#-1))}

I tested it, it does not work:

(1,2,3) echo {lcm(crop(#-1));resize(#-1,1,4,1,1,-1);i[#-1,3]=4;lcm(crop(#-1));}

Yes, that’s because the size of the vector crop(#-1) is determined at compile time, not at evaluation time (otherwise, you wouldn’t be limited to ‘static’ vectors).
When you want to manipulate images with varying sizes in a math expressions, then:

  • First, think about the fact that maybe a math expression is not optimal in this case.
  • Second, you may use the run() function, like this:
foo :
  (1,2,3)
  eval "
    lcm1 = run('u {lcm(crop(#-1))}');
    resize(#-1,1,4,1,1,-1); i[#-1,3] = 4;
    lcm2 = run('u {lcm(crop(#-1))}');
    print(lcm1,lcm2);
  "

Here’s for fun commands. I’m not supporting subpixel tools for G’MIC.

#@cli to_subpixel: window_size>=3
#@cli : Convert image to subpixel representation.
to_subpixel:
check isint($1,3)&&$1<${-min_w}&&${-min_h}

foreach {
	mw,mh,nw,nh:=dim=ceil([w,h]/$1);[dim,dim*$1];

	${arg\ 1+(s&1),to_gray,to_graya}

	if s==2
		s[-1] c
		/[-1] {iM}
		*[-2,-1]
	fi

	rescale2d[-1] $nw,$nh,0,1

	$mw,$mh,100%,3,"begin(
			const full_window_size=$1;
			const min_dim_window=ceil(full_window_size/3);
			windows_pos=int(cumulate(vector(#3,full_window_size/3)));
		);
		pos_x=x*full_window_size;
		pos_y=y*full_window_size;
		avg(
			crop(#-1,
				pos_x+windows_pos[c],pos_y,z,0,
				min_dim_window,full_window_size,1,1
			);
		);"

	rm[-2]
}
#@cli display_subpixel: scale_factor
#@cli : Display each subpixel.
display_subpixel:
foreach {
	if s!=3 continue fi
	{[w,h]*3},1,3
	eval[-2] "
		sx=x*3;
		sy=y*3;
		tx=sx;
		ey=sy+2;
		repeat(3,p,
			color=[0,0,0];
			color[p]=(I)[p];
			polygon(#-1,4,
				tx,sy,
				tx,sy,
				tx,ey,
				tx,ey,
			1,color);
			tx++;
		);
		I;"
	rm[-2]
}
#@cli subgrid2subpixel:
#@cli : Convert subgrid into subpixel representation.
subgrid2subpixel:
foreach {
	n 0,255
	{round([w,h]/3)},1,3,resize(crop(#-1,x*3,y*3,0,0,3,3,1,1),3,3,1,1,3,1,1,1,2);
}

Not too sure about this as a idea for a new individual filter, but I had fun with rep_zip command I made recently which I find useful for the new version of rep_rrd. I zipped 36 sample whose total dimensions is slightly over 16777216. Great execution time for 36 images (.546 s).

Seem like it has a interesting texture.

1 Like