I did just found the solution, to creating photo-mosaic, but the result are atrocious, but it works nevertheless.
#@cli rep_lbchstatfunc_to_pal: (eq. to rep_layers_by_channel_statistical_function_to_palette)
rep_lbchstatfunc_to_pal: rep_layers_by_channel_statistical_function_to_palette $*
#@cli rep_layers_by_channel_statistical_function_to_palette: variable
#@cli: Converts layers to palette using statistical function by channels per layers into 1x1 tile, then append them.
rep_layers_by_channel_statistical_function_to_palette: to_rgb rep_bchstatfunc $1 a x
#copy and paste below into code filter in g'mic, and copy and paste above to somewhere where you can remove it when not needed#
v=5
te={w<h?$v/w:$v/h}
to_a
at[0] "rep_bchstatfunc ia,0",{$te*w},{$te*h} r[^0] {$te*w},{$te*h},1,4,5 r[^0] {w#0},{h#0},1,4,0,2 +rep_lbchstatfunc_to_pal[^0] ia split_opacity[^{$!-1}] index[0] .,0,1 rm. l[^0-1] repeat {$!/2} +rep_bchstatfunc[{$>*2}] ia,0 done endl l[^1-{($!-1)-($!-2)/3}] repeat {$!-1} l[0,{$>+1}] f. "i#0==i#1?255:0" to_gray. endl done endl repeat {($!-2)/3+1} l[{1+($>*2)},{($!-1)-($!-2)/3+$>}] / 255 f.. "i#0*i#1" * 255 endl done rm[^0-{($!-1)-($!-2)/3}] repeat {($!-2)/2} a[{$>+2},{$>+3}] c done blend[^0-1] alpha rv[0,2] rm. split_opacity[0] blend[^0] multiply a c
Using code, you can change the value of v. Works with any layer greater than 3 as 2 are at least needed minimum for the mosaic.
Here’s the atrocious result -
That’s due to the indexing technique. I may need to find out just how to get a better indexing for the purpose of generating the mosaic. Either that or I may have to add blending using the original [0] image. Or both.
EDIT: One more example, but this time, more passable. Had to add more images for the mosaic result.
EDIT: I may have to keep in mind about expand_x, and expand_y for future filters.