Skip to content

Instantly share code, notes, and snippets.

@dmsnell
Last active March 11, 2018 21:54
Show Gist options
  • Select an option

  • Save dmsnell/40a754ce570395aeec3c3f639441173c to your computer and use it in GitHub Desktop.

Select an option

Save dmsnell/40a754ce570395aeec3c3f639441173c to your computer and use it in GitHub Desktop.
Build output images from Lightroom exports
output-jpgs = $(addprefix $1/,$(subst .tif,.jpg,$(wildcard *.tif)))
# $(call transform,quality,convert-args,optim-args)
define transform
convert $< -quality 98 $2 $@ && \
jpegoptim $@ -m$1 --all-progressive $3
endef
all: small-jpgs medium-jpgs large-jpgs
small-jpgs: $(call output-jpgs,small)
medium-jpgs: $(call output-jpgs,medium)
large-jpgs: $(call output-jpgs,large)
small/%.jpg: %.tif | small
$(call transform,87,-resize 1200x,-s)
medium/%.jpg: %.tif | medium
$(call transform,87,-resize 50% -filter box,-s)
large/%.jpg: %.tif | large
$(call transform,90,,)
small medium large:
mkdir -p $@
clean:
rm -rf small medium large
clean-tifs:
rm *.tif
# Reset implicit rules
.SUFFIXES:
MAKEFLAGS += --no-builtin-rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment