Skip to content

Instantly share code, notes, and snippets.

@vpetrov
Forked from anonymous/Makefile
Created March 25, 2017 16:06
Show Gist options
  • Save vpetrov/0dad3c2e8f6d1dc1c4eba82589c02462 to your computer and use it in GitHub Desktop.
Save vpetrov/0dad3c2e8f6d1dc1c4eba82589c02462 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