128x128x128 color sorting

you just did some black magic and it worked

I found a more generic way to generate this kind of images:

$ gmic N=128 256,256,256,3,'[((x*256/$N)&255)+int(x/$N),((y*256/$N)&255)+int(y/$N),z]' s z append_tiles , o out.png

Change the value of N (must be an integer that is a divider of 256), and if I understood well, the colors should be sorted as you wish.

Example with N=64:

Example with N=32:

3 Likes

that is genius it makes me want to learn coding since you can do so much if you understand the language

1 Like

i got this error

[gmic]./ Start G'MIC interpreter (v.3.5.0).
[gmic]./ Set local variable 'N=128'.
[gmic]./ Input image at position 0, with values ''[((x*256/128)'
[gmic]./ *** Error *** Command 'input': [instance(256,256,256,3,000001A0D50F2040,non-shared)] gmic<float32>::[gmic_math_parser] gmic<float32>::fill(): Unterminated string literal, in expression ''[((x*256/128)'.
[gmic] Command 'input' has the following description:
...

ending with this

'255)+int' is not recognized as an internal or external command,
operable program or batch file.
'255)+int' is not recognized as an internal or external command,
operable program or batch file.

Hi,
David’s pipeline works for me (Linux).
Looks like a truncated expression. Is it in a terminal? Are you missing a quote somewhere?

Not sure this works on Windows but you can try this on Linux:
gmic run 'N=128 256,256,256,3,[((x*256/$N)&255)+int(x/$N),((y*256/$N)&255)+int(y/$N),z] s z append_tiles , o out.png'

1 Like

yes that’s what i thought i will try it on linux

Ah yes, I haven’t tested on Windows, but as the shell is “slightly” different, you may have to put quotes or backslash somewhere.
That’s always the problem with this kind of command line: it always contains characters that are not managed the same way by the different shells :frowning:

1 Like

OK, on Windows, just replace the single quotes by double quotes, and the command works:

1 Like