This gallery gives a quick overview of the kind of features and generic filters available in the G'MIC open-source image processing framework.
All the images below have been processed by the CLI interface gmic of G'MIC, from a set of initial 2D color images. Click on an image to enlarge it and display the G'MIC command-line used for the processing (note: to reproduce this, you may have to escape some characters, according to the type of shell you use!).
Remember, G'MIC lets you define your own image pipelines through custom command files. Your custom filters can be easily added afterwards in the plug-in for GIMP or Krita.
For more details, visit the tutorial pages as well as the technical reference to get a full documentation on this software.
Arrays & Frames | Artistic | B&W | Colors | Deformations | Filtering | Patterns | 3D Meshes | Stylization | Code samples |

Lissajous
#!/usr/bin/env gmic # File : lissajous.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go =>[^] Lissajous e[] "" animate 60 # Main function go : v 0 300,1,1,3,u(255) tsp , # Generate random smooth colormap repeat 60 { e[] " > Frame "{$>+1}/60 (0^0^0;64) resize. 300,300,1,3,3 # Generate background image eval " const dt = "$>"*0.005; for (t = b = 0, t<3*pi, t+=0.05, # Draw balls x = w/2 + 4*w/9*cos((3.2+3*dt)*(t + dt)); y = h/2 + 4*h/9*sin((2.1-2*dt)*(t + dt)); ellipse(x,y,8,8,0,0.4,I[#0,b++]); ellipse(x+3,y-3,2,2,0,0.4,255); ); " wait 20 } rm[0] # End of file.
[ Source code ]

3D torus
#!/usr/bin/env gmic # File : torus3d.gmic # Author : David Tschumperle # Entry point when run from CLI: go =>[^] "Torus 3D" e[] "" animate 60 # Main function go : v 0 # Create 3d textured double-torus object. srand 16 repeat 2 { torus3d 70,20 100,100,1,3 plasma. 1,1,3 normalize. 0,255 equalize. 256 # Generate plasma texture +fill_color. ${-RGB} image.. .,0,0,0,0,0.6 # Tint it a little bit with a random color texturize3d... .. remove[-2,-1] } rotate3d. 1,0,0,90 +3d. 80,0,0 # Shift and merge torii +3d center3d rotate3d 1,0,0,30 *3d 2 # Create background image. 600,600,1,3 plasma. 1,1 normalize. 0,255 *. '[0.2,0.3,0.7]' # Generate animation frames. repeat 45 { e[] " > Frame "{$>+1}/45 +water[1] 100 object3d. [0],50%,50%,0,1,5,0 rotate3d[0] 1,2,3,8 } remove[0,1] # Remove 3d object + background r2dx 50% # Anti-alias frames # End of file.
[ Source code ]

Pacman
#!/usr/bin/env gmic # File : pacman.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go =>[^] Pacman e[] "" animate 60 # Main function go : v 0 # Create background image = [0]. 500,300,1,3 line 0,8%,100%,8%,1,1 line 0,92%,100%,92%,1,1 blur y,5%,1 * '[64,32,255]' normalize 0,255 # Create image of pellets = [1]. shape_circle 30 resize. 300%,100%,1,1,0,0,0.5 W:=w resize. ..,100%,1,1,0,2 # Create colormap = [2]. (0,0,0;255,255,255;255,255,0) permute. yzcx nbf=20 repeat $nbf { f=$> e[] " > Frame "{$f+1}/$nbf [0],[0] circle. 30%,50%,15%,1,2 y:=h/2-2*h*($f<$nbf/2?$f:$nbf-$f)/$nbf polygon. 3,30%,50%,100%,$y,100%,{h-$y} +fill. 0 image. [1],{w/10+2*$W*(1-$f/$nbf)},{(h-h#1)/2} max[-2,-1] map. [2] max. [0] } remove[0-2] # End of file.
[ Source code ]

Scrolling
#!/usr/bin/env gmic # File : scrolling.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go =>[^] Scrolling e[] "" animate 50 # Main function go : v 0 srand 32 # Define rendering sizes. wf,hf=512,384 wr,hr:=round(1.5*[$wf,$hf]) # Generate image [0] = line of text. input 0 text "G'MIC rocks ! ",0,0,48,1,1 wt,ht:=[w,h] resize {2.5*$wr},100%,1,1,0,2 # Generate image [1] = color gradient. input {10*ceil($hr/$ht)},1,1,3,u(64,255) tsp. , transpose. resize. $wr,$hr,1,3,3 # Generate image [2] = 3d cube (3d object). box3d {$wr/3} color3d. 255,32,200 center3d. # Generate animation frames. nbf=50 repeat $nbf { f=$> e[] " > Frame "{$f+1}/$nbf input $wr,$hr,1,1 repeat ceil($hr/$ht) { image. [0],{w/5*cos($>/3+2*pi*$f/$nbf)-$wt*(1+$f/$nbf)},{$>*$ht} } +mul[1,-1] remove.. rotate. 25,1,0 resize. $wf,$hf,1,100%,0,0,0.5,0.5 +fill. 0 +rotate3d[2] 1,-1,0,{180*$f/$nbf} rotate3d. 0,1,0,{360*$f/$nbf} rotate3d. 1,2,3,-60 object3d.. .,50%,50%,100,1,3,0,0 remove. div. 1.6 max[-2,-1] } keep[3--1] # End of file.
[ Source code ]

Landscape
#!/usr/bin/env gmic # File : landscape.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go =>[^] Landscape e[] "" animate 60 # Main function go : v 0 srand 512 # Generate elevation map [0] and texture [1] input 512,480 plasma. 1,1,5 resize. 100%,400%,1,1,0,2 blur. 3 cut. 40%,inf normalize. 0,255 input (0,102,51;149,175,124;102,42,0;255,255,255) permute. yzcx srgb2rgb. resize. 256,1,1,3,3 rgb2srgb. point. 0,0,0,1,64,100,200 +map.. . rm.. normalize[0] 0,40 # Generate background image [2]. input 1,4,1,3,"y==0?[50,0,100]:y==1?[219,140,15]:y==2?[140,18,15]:[100,0,0]" resize. 400,300,1,3,3 # Generate frames nbf=50 repeat $nbf { f=$> e[] " > Frame "{$f+1}/$nbf y:=h#0/4*(1+$f/$nbf) ang:=6*sin(2*pi*$f/$nbf) +rows[0,1] $y,{$y+h#0/3-1} w,h={[w,h]} rotate[-2,-1] $ang,1,0,50%,50% +fill.. 'y/h' cut. 5%,50% normalize. 0,1 input 100%,100%,1,3,'[219,140,15]/3' image... .,0,0,0,0,1,.. remove[-2,-1] elevation3d. .. remove.. reverse3d. -3d. {$w/2},0,0 r3d. 1,0,0,90 +3d. 0,50,0 *3d. {-2,4*w/$w} +object3d[2] .,50%,35%,-250,1,5,0,1,300,0,-1000,-2200,0.3,0.5 remove.. } remove[0-2] # Quantize all frames in 256 colors with the same colormap, to avoid .gif flickering. +colormap[50%] 256 index[^-1] .,0,1 remove. # End of file.
[ Source code ]

Mandelbrot
#!/usr/bin/env gmic # File : mandelbrot.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go =>[^] "Mandelbrot" e[] "" animate 60 # Main function go : v 0 # Create colormap. srand 0 input 256,1,1,3,u(255) tsp. , point. 0 # Generate frame. target=-0.77175402641296387,0.10690001025795937 zoom=1e-2 nbf=100 repeat $nbf { f=$> e[] " > Frame "{$f+1}"/"$nbf input 512,512 iter_max:=round(lerp(512,16384,$%^4)) mandelbrot. {"C = ["$target"]; z = "$zoom"; [C - z, C + z ]"},$iter_max map. [0] rotate. {180*cos(pi*$f/$nbf)},2,0,50%,50% cut. 0,255 resize. 256,192,1,3,0,0,0.5,0.5 zoom*=0.93 } remove[0] # Make frames loop, using temporal fading. append z +slices. 0,10% input 100%,100%,100%,1,'z/d' image[0] ..,0,0,{d#0-d#2},0,1,. slices[0] {d#2},100% keep[0] split z # End of file.
[ Source code ]

Heart
#!/usr/bin/env gmic # File : heart.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go =>[^] Heart e[] "" animate 60 # Main function go : chromeball64x64 255,20,0 resize2dx. 48 split c,-3 600,500,1,3,"(y*[0,20,100]+(h-y)*[200,100,200])/h" .x9 eval " S = crop(#0); A = crop(#1); for (t = -pi; f = 0, t<3*pi, t+=0.02, P = 268-15*[16*(sin(t)^3),13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)+5]; draw(#2+f,S,P[0],P[1],48,48,1,A,255); f = (f+1)%10; )" remove[0,1] # End of file.
[ Source code ]

Distortion
#!/usr/bin/env gmic # File : distortion.gmic # Author : David Tschumperle # Entry point when run from CLI: go =>[^] Distortion e[] "" animate 50 # Main function go : v 0 nbf=50 sample cat repeat $nbf { e[] " > Frame "{$>+1}/$nbf +f[0] "const boundary = 3; const interpolation = 1; j( w/16*cos(2*pi*"$>/$nbf" + 0.5*sin(y/50)), h/16*sin(2*pi*"$>/$nbf" + 0.5*cos(x/30)))" } remove[0] # End of file.
[ Source code ]

Rotozoom
#!/usr/bin/env gmic # File : rotozoom.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go r2dx 200%,1 =>[^] Rotozoom e[] "" animate 70 # Main function go : v 0 nbf=70 sp colorful repeat $nbf { e[] " > Frame "{1+$>}"/"$nbf 240,240,1,3," const boundary = 2; const interpolation = 1; const t = "$>/$nbf"; const pit2 = 2*pi*t; dx = 4*w#0*t; dy = 3*h#0*t; zoom = 0.35 + 0.3*sin(pit2); angle = pit2*180/pi; rot = rot(angle°)/zoom; P = [ w#0,h#0 ]/2 + [ dx,dy ] + rot*[ x - w/2,y -h/2 ]; i(#0,P)" } rm[0] # End of file.
[ Source code ]

French Flag
#!/usr/bin/env gmic # File : pacman.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go =>[^] "French Flag" e[] "" animate 30 # Main function go : v 0 # Render animation frames. nbf=200 repeat $nbf { f=$> e[] " > Frame "{$f+1}/$nbf 300,300,1,3,"* const f = $f; const nbf = $nbf; begin(R = rot(10°*sin(f*2*pi/nbf))); Z = 80 + 40*cos(x/230 + 2*pi*f/nbf)*sin(y/50 + 3*2*pi*f/nbf); P = round(R*(Z + 100)*([x,y] - [w,h]/2)%); (0.4+exp(-Z/60))*(P[0]<-96?[0,0,255]:P[0]<96?[255,255,255]:[255,0,0])* lerp(0.5,1,xor(P[0]%64,P[1]%64)/64)" c. 0,255 }
[ Source code ]

Snow
#!/usr/bin/env gmic # File : heart.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go =>[^] Snow e[] "" animate 60 # Main function go : v 0 nbf=400 shape_snowflake 300 repeat 100 { f:=3+0.5*$> +r[0] $f%,$f%,1,1,2 rotate. {lerp(0,90,$>/10)},1,0 } rm[0] a z,0.5 autocrop. r2dx. 16 l[] { 8,1,1,{3*1000} rand. 0,1 s c,-3 rbf $nbf,0,1 a c } repeat $nbf { f=$> e[] " > Frame "{$f+1}/$nbf 400,400 {1,s/3},1,1,1," begin(P = I[#1,"$>"]; S = vector(#w#0*h#0*3,255)); k3 = 3*x; x = P[k3]*w#-1; y = P[k3 + 1]*h#-1; r = round(lerp(0,d#0 - 1,cut(P[k3 + 2],0,1))); M = crop(#0,0,0,r,w#0,h#0,1); draw(#-1,S,x,y,0,0,w#0,h#0,1,1,0.75,M); " rm. to. "Snow",0.5~,0.5~,${"font macondo,150"},3,1,255 } rm[0,1] # End of file.
[ Source code ]

Fire
#!/usr/bin/env gmic # File : fire.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go =>[^] "Fire" e[] "" animate 60 # Main function go : v 0 300,300x2 => trail,canvas 100,100,1,4,"[ u(w#$trail - 1),u(h#$trail - 1),unitnorm([g,g]) ]" => agents nbf=200 repeat $nbf { f=$> e[] " > Frame "{$f+1}"/"$nbf f[canvas] 0 f[agents] ":begin( const no = 5; # nb_orientations const da = 40; # angle const sd = 10; # sensor_distance; const md = 5; # move_distance; # Pre-compute rotation matrices. Rs = vector(#4*no); off = 0; repeat (no,k, ang = lerp(-da,da,k/(no - 1)); copy(Rs[off],rot(ang°)); off+=4); ); A = I; X = A[0,2]; U = A[2,2]; # Get sensor information. max_orientation = max_value = -inf; repeat (no,k, R = Rs[4*k,4]; sX = round(X + sd*mul(R,U)); value = i(#$trail,sX,1,2); value>max_value?(max_value = value; max_orientation = k); ); # Turn agent according to sensor measure. max_orientation = round(max_orientation*(no - 1)/(no - 1)); R = Rs[4*max_orientation,4]; U = lerp(U,mul(R,U),0.2); # Move agent along new orientation. X+=md*U; X[0]%=w#$trail; X[1]%=h#$trail; iX = round(X); ++i(#$trail,iX); ang = atan2(U[1],U[0]); ellipse(#$canvas,iX,4,1,ang,0.2,255); [ X,unitnorm(U) ]" b[trail] 3,2 deform[trail] 2 n[trail] 0,1 +map[canvas] hot } k[80--1] # End of file.
[ Source code ]

3D Cube
#!/usr/bin/env gmic # File : cube3d.gmic # Author : David Tschumperle # Entrypoint when run from CLI: go =>[^] "3D Cube" e[] "" animate 40 # Main function go : v 0 # Create textured checkerboard (floor) and cube. quadrangle3d 0,0,0,0,1,0,1,1,0,1,0,0 col3d. 0 star3d 5,0.5 *3d. 0.4 +3d. 0.5,0.5 col3d. 1 +3d. 0,0,-1e-2 +col3d.. 2 +col3d.. 3 +3d[-4,-3] +3d[-2,-1] +rv +3d[-3,-1] 1,0,0 +3d[-2,-1] 0,1,0 +3d array3d 16,16 => floor box3d 1,1,1 l. { s3d. f.. 6+2*int(y/3) a y } => cube (16^32^96;16^16^32;0^0^0) r. 512,512,1,3,3 => background 18,1,1,3,"x>=4?[64,0,32]:[0,0,0]" => colormap # Generate animation. nbf,f:=6*16,1 srand 5 repeat 6 { dir:=arg0($>,0,3,0,2,2,0) shift:=arg0($dir,[1,0,1],[0,0,1],[1,0,1],[1,1,1]) axis:=arg0($dir,[0,-1,0],[0,1,0],[-1,0,0],[1,0,0]) scroll:=arg0($dir,[-1,0,0],[1,0,0],[0,1,0],[0,-1,0]) repeat $nbf/6 { t:=$>/($>+$<+1) e[] " > Frame "$f"/"$nbf f+=1 ang:=lerp(0,90,$t) +-3d[cube] $shift r3d. $axis,$ang +3d. $shift # Rotate cube around bottom edge +3d. 16,16,-1 +3d. [floor] # Place cube on the floor +3d. {$t*[$scroll]} # Scroll floor -3d. 16,16,0 *3d. 110 r3d. 0,0,1,35 r3d. 1,0,0,-50 # Rotate whole object to have a nice view {background,[w,h]} j3d. ..,50%,50%,0,1,2,0,1,400 # Draw object on canvas +f. "const boundary=1; M = abs(maxabs(i - j(1),i - j(0,1))); M>1?1:M>0?0.3:0" *. 255 dilate. 2 # Render as black & white outline map.. [colormap] max[-2,-1] max. [background] +b. 10,0 n. 0,200 +[-2,-1] c. 0,255 rows. 10,100% # Remove ugly top part due to 3D perspective rs. 480 rm.. } } k[4--1] # End of file.
[ Source code ]
Arrays & Frames | Artistic | B&W | Colors | Deformations | Filtering | Patterns | 3D Meshes | Stylization | Code samples |