One-liner challenge

gmic sp inside g xy,-1 sign g.. x,1 g. y,1 add ilaplacian ,

The kilometrage varies with ilaplacian. Not sure what to do with it…

Seen a Twitter post about this today (but cannot find the link anymore). It creates an image that exhibits a strong 3D effet (at least for me, particularly when I move my head) :

$ gmic 800,800,1,3 s0,s1,s2,s3,s4=\"255,0,0\",0,\"0,0,255\",0,\"255,0,0\" repeat 5 circle 50%,50%,'{arg0($>,35,25,22,13,10)}'%,1,'${s$>}' done f 'u<0.1?0:i' erode_circ. 3 r2dx 50%

weird3d

2 Likes

Ah yes, that’s called “Colour Pseudo-Stereopsis”, caused by chromatic aberration of the eye, and pupils not being central. Interestingly the effect can be reversed depending on the observer!

2 Likes

lovely example here https://twitter.com/DrNabinPaudel/status/1065340318126612480/photo/1

more recent tweet https://twitter.com/AkiyoshiKitaoka/status/1481642855840231425

2 Likes

I have been wondering if it was possible to generate random numbers via new seed, it appears it is possible! If you change 45 to something else, note the other numbers doesn’t change.

$ gmic echo {expr('>begin(test=[2,6];seed_collect=[23,45,60];k=0;test_seed=1;);if(x==test[k]&&k<2,++k;test_seed=1;);if(test_seed,srand(seed_collect[k]);test_seed=0;);int(u(0,11));',12)}

This would be perfect for finishing up new version of Stitch filter.

This is the expanded expr code.

expr('

 >begin(
  test=[2,6];
  seed_collect=[23,45,60];
  k=0;
  test_seed=1;
 );

 if(x==test[k]&&k<2,
  ++k;
  test_seed=1;
 );
 if(test_seed,
  srand(seed_collect[k]);
  test_seed=0;
 );
 int(u(0,11));'

, 12 )

A random generator is implemented as a sequence like:
x_{n+1} = \mod{(a\;x_n + b,c)},
with a,b and c, prescribed values (usually very large numbers)

When you set a random “seed” with srand(), you actually just set a new value for x_n, so you’ll always get the same sequence x_{n+1} , x_{n+2}, ... after that.

I like to revive this at a certain time of year :slight_smile:
Maybe others have some weird things saved up?

gmic sp bottles dilate 11 laplacian f "(x-y)%2?i:-i" +b 10% - sign
bottles

2 Likes

Been mostly refactoring and improving code in syntax, speed, ans readability. Still a few months away from done. So, not much from me.

Hmm ok, in that case I’ll do another on your behalf :smiley:

gmic sp wall s y foreach { sub {ia} cumulate x sub {ia} } a y
wall

1 Like

Found this one this morning, I like it :slight_smile:

300,300x5 foreach { noise_poissondisk 40 +distance 1 label_fg.. 0 mul. -1 watershed.. . rm. g xy,1 a c } norm neq 0 distance 1 apply_gamma 1.5 n 0,255 morph 20,0.1 map copper +rv[^0] animate 20

@paperdigits , do you know if it is possible to enable auto-loop mode for the video?

2 Likes

I don’t think it can be done in markdown. If you edited the markdown to the html5 video element, then yes: <video>: The Video Embed element - HTML: HyperText Markup Language | MDN

1 Like

Hello,
found a few weird stuff tonight (don’t forget the “w” !)

Shredder? :
gmic -v -1 sp repeat "{0,w*4}" rotate 15,0,0,"{$>}","{$>}" rotate -15,0,0,"{$>}","{$>}" rr2d 500,500,0,0 w done

The Eye:
gmic sp lena repeat 2000 rotate {v*1.8},0,3,53%,53% w done d

One day (don’t move the window ):
gmic -v -1 sp earth repeat 99 adjust_colors ,,,"{$>}" w done repeat 1500 rotate {v*5},0,2,50%,50% rotate "0.05,0,0,{50-$>/10}%,10%" adjust_colors ,,,{u*5} w done repeat 500 rotate {v*5},0,2,50%,50% rotate "0.05,0,0,{50-$>/10}%,10%" adjust_colors ,,,{u*5} w "{$<}","{$<}",0,0,50%,50% done

All these are (sort of) animated, so i don’t have screenshots (no spoilers heh)

EDIT: for some reason the last 2 don’t work on my other computer… bad substition for {v*5} ? (gmic 3.1.6)

EDIT : Worked fine on a 3rd computer (Manjaro on Mac M1 with UTM, gmic 3.2), and worked fine after update on 2nd computer.

Good night!

2 Likes

Nice ones !
Artifacts generated by iterated discrete rotations always give a nice fractal-looking aspect to the images. I’ve used this kind of trick also in x_whirls.

Yes, the variable v has been introduced in 3.2.0, so 3.1.6 won’t recognize it.

@David_Tschumperle Thanks!

It was indeed fun to do, even thought I don’t know my maths and it’s more random experiments for me. Still, good exercise to learn the predefined variables.

The rotation command can give good effects too. I have a little line that gives almost a watercolor-like effect, which is just what I’m looking for.

3D Menger Sponge

3,3,3,1,norm([x,y,z]-1)>1 (200) repeat 4 { r. {3*[w,h,d]},1,0,2 +ri[0] . *[-2,-1] } to_rgb. dv3d.

Haven’t found a smaller version, though it is probably possible with some XOR spells !

4 Likes

A few things found while following the bounding balls tutorial

gmic 255,255,127,3,"[ xor(x,y)%(z+1) ]"


gmic input 255,255,1,3,"xor(x,y)%16<(x+y)/30?[ 255,0,0 ]:[ 255,255,255 ]"
image

4 Likes

I wanted to try a code-golf challenge:

m=1 repeat $1 { e {expr('$m+x',$>+1)} m+=$>+1 }

The above code prints pyramid of numbers. 47 bytes.

So, what does this do?

sample square 100%,100%,1,2,[x,y] +spiralbw {w},{h},0 negate. pixelsort.. +,xy,. rm. resize[-1] {wh},1,1,100%,-1 +pal wcmyk eval.. ">"color_ind=vector(#whd#-1,0);cur_col=I(#-3,I);repeat(s#-1,k,color_ind+=sqr(crop(#-1,0,0,0,k,w#-1,1,1,1)-cur_col[k]););color_ind=sqrt(color_ind);p=argmin(color_ind);color=I[#-1,p];quant_error=I(#-3,I)-color;I(#-3,J(1))+=quant_error*3/16;I(#-3,J(2))+=quant_error*5/16;I(#-3,I)=color; k[0]

I must admit the artifact is interesting:

Reminiscent of index, but mostly constrained in the amount of error diffusion it is allowed to do.

indexerrdiff: -check ${"is_image_arg $1"} -skip "${$2=1}"

   errdiff=$2
   pass$1 1
   index.. .,$errdiff,1
   rm.

 $ gmic /dev/shm/errdiff.gmic sp square,800 pal wcmyk -v + indexerrdiff.. .,0.375 rm.
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input custom command file '/dev/shm/errdiff.gmic' (1 new, total: 4572).
[gmic]-1./ Input sample image 'square' (1 image 800x533x1x3).
[gmic]-2./+pal/ Create palette(s) 'wcmyk'.
[gmic]-2./ Increment verbosity level (set to 2).
[gmic]-1./indexerrdiff/ Set local variable 'errdiff=0.375'.
[gmic]-1./indexerrdiff/ Insert image [1] from parent context in shared state.
[gmic]-2./indexerrdiff/ Index values in image [0] by LUT [1], with dithering level 0.375 and index mapping.
[gmic]-2./indexerrdiff/ Remove image [1] (1 image left).
[gmic]-2./ Remove image [1] (1 image left).
[gmic]-1./ Display image [0] = 'square'.
[0] = 'square':
  size = (800,533,1,3) [4996 Kio of float32].
  data = (0,0,0,0,0,0,0,0,0,0,0,0,(...),255,0,255,0,255,0,255,0,255,0,255,0).
  min = 0, max = 255, mean = 118.349, std = 127.171, coords_min = (0,0,0,0), coords_max = (1,1,0,0).

However, in your case, the means of error diffusion differs from that of index. If I were just glitching, anything goes, I suppose, but if I were driven by obtaining as smooth and uniform distribution of error as possible, I’d be concerned with the diagonal seam artifacts visible in your example, (upper left hand corner, in the sky, as is less visible in the other corners) which — if I am reading the expression correctly — seems to be a characteristic of your half-toning image. I’d have to sit down with this during a pleasant Sunday Morning After Breakfast period, and not going headlong into Manhattan. Not a good time to be parsing things.

Somewhat reminds me of Gmic Exercises - #960 also. Thank you for this fun, early morning exercise.