One-liner challenge

Sometimes, I play with gmic on the command line, experimenting some basic ideas.
It often ends up with pure garbage, but sometimes I get cool and unexpected images or animations, only with a single command line. So, why not sharing these happy accidents ?

The concept of the challenge is then to propose a single command line (involving one single use of gmic) such that it generates something “cool” (still image, in .png or .jpg, or an animation as an animated .gif).
It would be cool if we could just copy/paste the command line on the shell and see what happens :heart_eyes:

Even if I think I’ll be the only one participant :cold_face:, I open this thread, and try to post new things regularly (at least when I get some new surprises). Anyone wants to play ?


  • Here is entry #1:

Command line:

$ gmic 500,500 repeat 10 +noise_poissondisk[0] "{3+$>}" done rm[0] a z f '!z?(R=cut(norm(x-w/2,y-h/2)/20,0,d-1);i(x,y,R)):0' slices 0 to_rgb f "max(I)?u([255,255,255]):I" blur_radial 0.6% equalize n 0,255

Result:
gmic_challenge1

5 Likes

Did you come up with your one-liner by accident? What were you trying to do initially?

I write one-liners all of the time even though I should be using *.gmic files. The reason that I don’t do the latter is that I still don’t know how to import them into my user.gmic. Please help me figure that out. It would help me be more organized and motivated to write better filters. :slight_smile:

Occasionally, the one-liners do result in something interesting (I may have shared a few before). I will keep this thread in mind when something new happens but I might not remember or it might be uninteresting. :sweat_smile:

Looks like something out of certain films!
Sadly I usually discard those accidents, I may have one or two kept though :slight_smile:
I distinctly remember one with G’MIC looking quite snowflake-like.
The best I ever saw was one I couldn’t keep, back in the days of DOS. A random crash caused the most incredible animation, I assume due to data being executed as code!

Edit: found one! Very like glitch art so using a familiar image…

gmic run "image.jpg +structuretensors eigen. rm.. mix_channels. (0,-10;10,0) repeat 10 warp.. .,1 mul. -1 done rm."

scatter

Edit2: One more - this time a sort of glassy effect:

gmic sp cliff +orientation n. 0,255 luminance[0] +b[0] 2% min[0,-1] blend multiply n 0,255
cliff

3 Likes

The first one looks like a boxing match. :fist_right::crazy_face:

I like playing with norm and orientation.

Ah, I thought this issue was already solved :frowning:
I do it all the time in my .gmic file (on Linux), in my cli_start command (a command that is executed at startup by the gmic CLI tool). I can say the following command, put in my .gmic file works as expected:

cli_start :
  v -
  l[] m $HOME/work/src/gmic/src/gmic_stdlib.gmic onfail endl
  l[] m $HOME/work/src/resources.gmic onfail endl
  md3d 3
  v +

I’m working on Linux, so $HOME is defined. But I’ll give a try on Windows this afternoon to see how this can be converted.

Here is a one-liner that has the makings of a glitch filter:

gmic repeat 6 sp done otsu , gradient_norm r2dx {max({0,h},{1,h})} autocrop_seq 0 a c,.5

Planet of the mandrills (tagline: dog saves the world)

sample0


What is David thinking about?


Issues

1. I don’t know how to save it with 3 channels while retaining the colour info.
2. Sometimes there is a bar at the bottom that I cannot crop because it isn’t fully black. E.g.,

afre2

2 Likes

Another one-liner that I did yesterday, using part of my hessian norm filter.

gmic sp +l otsu , af_hnorm n 0,1 endl +* blend overlay

afre_flower

With these one-liners, small changes make it do slightly (or significantly) different things.

gmic sp +l otsu , af_hnorm 1 n 0,1 endl +* blend overlay

1 Like

I’ll be monitoring this thread so that I can use some of these for filters (I won’t take any credit).

@Joan_Rake1 I am sure you have things to share as well. :wink:

I’m best at extending what I see in front of me for now. I’ve already used your hessian one-liner here, and this is an example of what it can do:

image

Something a bit different, an animated effect. “Don’t try this at home” if your PC is really slow:

gmic 600,600 v - repeat 100 f "init(a=8e18*u;b=8e18*u;q=8e18*u);n=xor(a,a<<13);a=b;b=q;q=xor(xor(q,q>>15),xor(n,n>>10));b+q" w done v +

It might remind you of a certain TV effect :slight_smile:

1 Like

It’s probably fine, just reduce the image size at the beginning!
I’m probably overstating the performance problem and don’t want to spoil it :slight_smile:

It was short, so I added more repeats. :slight_smile: Is that grey border supposed to be there? It disappears when I resize the window. A bug?

Spoilers

image

Hmm not certain… I don’t get that on linux at least. Maybe something to do with screen resolution too?

It doesn’t happen when the image (and thus the window) is bigger.

My favorite one-liner so far :

$  gmic https://framagit.org/dtschump/gmic/raw/master/resources/samples/bbq_intro2016.gmic go

(yes, I’m cheating! :wink: ).

EDIT : works best on Linux, really slow on Windows, I still don’t know why.

1 Like

Hahah nice, but definitely cheating! I’m also quite sure nothing there was accidental :smiley:

Yes, it is very slow. No music either. I get this error:

'cvlc' is not recognized as an internal or external command,
operable program or batch file.

After the BBQ animation, everything is normal speed.

Got two of my own:

f "angle=pi;i(sqrt((x-w/2)^2+(y-h/2)^2),sqrt((x-w/2)^2+(y-h/2)^2),z,c,1,1)"

f "angle=0;i(x*cos(angle)+y*sin(angle),-x*sin(angle)+y*cos(angle),z,c,1,2)"

The first makes circular textures out of images. The second’s some generic rotation thing that one can use to distort images.

Here is a bash/gmic/ffmpeg combo move:

  • From a dir with images capture000000.jpgcapture000309.jpg
cp capture000000.jpg out000000.jpg ; prev=0 ; previous=0 ; counter=1 ; current=1 ; until [ $counter -gt 309 ] ; do current=$(echo 0000000$counter|tail -c 7) && prev=$((counter-1)) && previous=$(echo 0000000$prev|tail -c 7) && previous=$(echo 0000000$prev|tail -c 7) && gmic capture$(echo $current).jpg out$(echo $previous).jpg blend lighten -o out$(echo $current).jpg && ((counter++)) ; done && ffmpeg -framerate 48  -i out%06d.jpg -vcodec libx264 -s 1280x720 -preset slow -crf 5 -pix_fmt yuv420p  ~/Desktop/startrails1d.mkv

Well that was fun, but I imagine this can be done with a simpler gmic command.

2 Likes