Sort images according to N-Sized Channels

Let’s say I have 2 1D images. Second has multiple channels, and let’s say 5 for this case. How should I sort the first one according to the values of channels of the second one akin to radix sort and treating the values of the second one as digits in each channels?

We need more information. Please give an example, a simple one please.

A very simple case is this:

foo:
numbers_of_values=12 
$numbers_of_values,1,1,1,x 
$numbers_of_values,1,1,3,int(u(0,256,1,0)) 

rgb2int[-1]
pixelsort[-2] +,x,[-1] 
rm[-1]

You sort according to the values of each channels this way. This case works well for 3 channels, and integer numbers 0-255 inclusive only. But what about cases the values ranges beyond 0-255, and arbitrary numbers of channels like 2,4,5,6,7…?

It is clearer now. I will let someone else answer, as my brain is still quite distant from G’MIC and math. I will get back into it someday…

1 Like

After figuring out Advent of Code Day 7. I figured that you can do that with eval and sort() within eval, and using permute too. Not the most ideal solution, but it should work.