Celtic Knot Generator for SVG

celtic-knot is a Ruby programme that creates simple rectangular celtic knot drawings based upon a given set of parameters. The images are in a vector format.

Synopsis

The drawing is in SVG (Scaleable Vector Graphics) format, which is sent to standard output.

Usage

Usage: ./knot [options]
    -h, --help                       Prints this help
    -V, --vertical=VERTICAL          Number of cells vertically.
    -H, --horizontal=HORIZONTAL      Number of cells horizontally.
    -G, --cell-size=CELL_SIZE        Dimensions of each cell in the grid.
    -b, --background-color=BG_COLOR  Background colour.
    -k, --knot-color=KNOT_COLOR      Knot colour.
    -K, --knot-width=KNOT_WIDTH      Knot width.
    -s, --stroke-color=STROKE_COLOR  Stroke colour.
    -S, --stroke-width=STROKE_WIDTH  Stroke width.

Examples

Basic

Basic knot

$ ./knot \
    --vertical=2 \
    --horizontal=2 \
    --cell-size=96 \
    --knot-color='white' \
    --knot-width=24 \
    --stroke-color=black \
    --stroke-width=8 \
    > examples/basic.svg

Ingƿine

Ingƿine knot

$ ./knot \
    --vertical=3 \
    --horizontal=4 \
    --cell-size=96 \
    --background-color='#012169' \
    --knot-color='#C8102E' \
    --knot-width=32 \
    --stroke-color=white \
    --stroke-width=16 \
    > examples/ingwine.svg

Bratach (Banner)

Bratach knot

$ ./knot \
    --vertical=5 \
    --horizontal=6 \
    --cell-size=64 \
    --background-color='#169B62' \
    --knot-color='#FF883E' \
    --knot-width=32 \
    --stroke-color=white \
    --stroke-width=4 \
    > examples/bratach.svg

Converting SVG to Other Formats

The SVG file can be viewed locally in your Web browser or converted into other formats such as PNG using utilities such as ImageMagick's convert. For example:

convert -background none examples/basic.svg examples/basic.png

Internals

API Documentation

Author

2023 Damien Bezborodov