FULLPICS = $(wildcard full/*.jpg) THUMBS = $(patsubst full/%.jpg,thumb/%.jpg,$(FULLPICS)) THUMB_DIM = 400 THUMB_ASPECT_RATIO = 1:1 CONVERT_OPTIONS = -quality 75 -strip -interlace Plane +repage all: $(THUMBS) thumb: mkdir -p thumb thumb/%.jpg: full/%.jpg thumb convert "$<" \ -resize '$(THUMB_DIM)x$(THUMB_DIM)^' \ -gravity "$$(./gravityof.sh "$<")" \ -crop "$(THUMB_ASPECT_RATIO)" \ $(CONVERT_OPTIONS) "$@" clean: rm -f $(THUMBS)