Primitive Pictures

14 Nov 2017

Input

Take an input image like this:

Input for the
primitive program.

Create 100 rotated ellipses and store every 5th frame as a Portable Network Graphics (PNG) file:

./primitive -i invplace.png -o rotatedellipse_%03d.png -nth 5 -n 100 -m 7 -v

Animated GIFs

Use those PNG files to create an animated GIF (Graphics Interchange Format):

Using a hundred
rotated elipses.

convert -delay 1 -loop 0 rotatedellipse_???.png invplace_rotatedellipse.gif

Or use another mode (e.g. polygon):

Using a hundred
polygons.

Use more primitives

Using a
thousand rotated elipses.

Using a thousand
polygons.

Software used

You can find the source code for the primitive executable (written in Go) on GitHub. There is also a version for macOS. The convert executable is part of ImageMagick.

Have fun with your own images and all the options:

./primitive -h
Usage of ./primitive:
  -a int
        alpha value (default 128)
  -bg string
        background color (hex)
  -i string
        input image path
  -j int
        number of parallel workers (default uses all cores)
  -m int
        0=combo 1=triangle 2=rect 3=ellipse 4=circle 5=rotatedrect 6=beziers 7=rotatedellipse 8=polygon (default 1)
  -n value
        number of primitives
  -nth int
        save every Nth frame (put "%d" in path) (default 1)
  -o value
        output image path
  -r int
        resize large input images to this size (default 256)
  -rep int
        add N extra shapes per iteration with reduced search
  -s int
        output image size (default 1024)
  -v    verbose
  -vv
        very verbose