Skip to content

Instantly share code, notes, and snippets.

Created March 25, 2017 15:10
Show Gist options
  • Save anonymous/99adb1676230d44ab144ea9df6ca9f6b to your computer and use it in GitHub Desktop.
Save anonymous/99adb1676230d44ab144ea9df6ca9f6b to your computer and use it in GitHub Desktop.
Uses ImageMagic to generatee an image of a starry night and save it as starry_night.jpg.
#!/usr/bin/env make
# This file contains TAB characters, in addition to spaces.
MAGIC:=convert
OUTPUT:=starry_night.jpg
SIZE:=1920x1080
HOW_STARRY:=10
HOW_BLURRY:=0x2
COW:="40%,50%"
.PHONY: starry_night levels blur noise black magic
starry_night: magic levels
@echo For a starry night, open ${OUTPUT}\!
levels: blur
@${MAGIC} ${OUTPUT} -level ${COW} ${OUTPUT}
blur: noise
@${MAGIC} ${OUTPUT} -blur ${HOW_BLURRY} ${OUTPUT}
noise: black
@${MAGIC} ${OUTPUT} -evaluate Gaussian-noise ${HOW_STARRY} ${OUTPUT}
black:
@${MAGIC} -size ${SIZE} xc:black ${OUTPUT}
magic:
@which ${MAGIC} >/dev/null || (echo "Please install ImageMagick on your system. Thank you."; exit 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment