Skip to content

Instantly share code, notes, and snippets.

@Ortham
Created January 14, 2017 10:48
Show Gist options
  • Save Ortham/d00249731305f1a2440e6ae87d2730bb to your computer and use it in GitHub Desktop.
Save Ortham/d00249731305f1a2440e6ae87d2730bb to your computer and use it in GitHub Desktop.
Image reproduction using Primitive
#!/bin/bash
# Generate a single image using Primitive.
# https://github.com/fogleman/primitive
INPUT_FILE=$(ls $1/*.jpg | head -1)
OUTPUT_FILE=$1/$1.png
SHAPES_NUMBER=$2
if [ "$3" == "combo" ]
then
GEOMETRY=0
elif [ "$3" == "triangles" ]
then
GEOMETRY=1
else
GEOMETRY=7
fi
primitive -o $OUTPUT_FILE -n $SHAPES_NUMBER -i $INPUT_FILE -m $GEOMETRY -s 4096
#!/bin/bash
# Generate multiple Primitive images composed of triangles and rotated ellipses.
# https://github.com/fogleman/primitive
OUTPUT_FOLDER=$2/triangles
mkdir -p $OUTPUT_FOLDER
primitive -o $OUTPUT_FOLDER/output-%d.png -n 500 -nth=100 -i $1 -m 1
OUTPUT_FOLDER=$2/rotatedellipse
mkdir -p $OUTPUT_FOLDER
primitive -o $OUTPUT_FOLDER/output-%d.png -n 500 -nth=100 -i $1 -m 7
mv $1 $2/$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment