Browse Source

Externalize image optim to a script

exp-with-scrum
parent
commit
803e7c2a43
Signed by: yogsototh GPG Key ID: 7B19A4C650D59646
  1. 17
      Makefile
  2. 22
      engine/optim-img.sh

17
Makefile

@ -137,22 +137,23 @@ gemini: $(DST_GMI_FILES) $(GMI_INDEX) $(GEM_ATOM)
# Images
SRC_IMG_FILES ?= $(shell find $(SRC_DIR) -type f -name "*.jpg" -or -name "*.jpeg" -or -name "*.gif" -or -name "*.png")
DST_IMG_FILES ?= $(patsubst $(SRC_DIR)/%,$(DST_DIR)/%, $(SRC_IMG_FILES))
OPTIM_IMG := engine/optim-img.sh
$(DST_DIR)/%.jpg: $(SRC_DIR)/%.jpg
$(DST_DIR)/%.jpg: $(SRC_DIR)/%.jpg $(OPTIM_IMG)
@mkdir -p $(dir $@)
convert "$<" -quality 50 -resize 800x800\> "$@"
$(OPTIM_IMG) "$<" "$@"
$(DST_DIR)/%.jpg: $(SRC_DIR)/%.jpeg
$(DST_DIR)/%.jpg: $(SRC_DIR)/%.jpeg $(OPTIM_IMG)
@mkdir -p $(dir $@)
convert "$<" -quality 50 -resize 800x800\> "$@"
$(OPTIM_IMG) "$<" "$@"
$(DST_DIR)/%.gif: $(SRC_DIR)/%.gif
$(DST_DIR)/%.gif: $(SRC_DIR)/%.gif $(OPTIM_IMG)
@mkdir -p $(dir $@)
convert "$<" -quality 50 -resize 800x800\> "$@"
$(OPTIM_IMG) "$<" "$@"
$(DST_DIR)/%.png: $(SRC_DIR)/%.png
$(DST_DIR)/%.png: $(SRC_DIR)/%.png $(OPTIM_IMG)
@mkdir -p $(dir $@)
convert "$<" -quality 50 -resize 800x800\> "$@"
$(OPTIM_IMG) "$<" "$@"
.PHONY: img
img: $(DST_IMG_FILES)

22
engine/optim-img.sh

@ -0,0 +1,22 @@
#!/usr/bin/env zsh
src="$1"
dst="$2"
convert "$src" -quality 50 -resize 800x800\> "$dst"
# mogrify -path "$dst" \
# -filter Triangle \
# -define filter:support=2 \
# -thumbnail 800 \
# -unsharp 0.25x0.25+8+0.065 \
# -dither None \
# -posterize 136 \
# -quality 82 \
# -define jpeg:fancy-upsampling=off \
# -define png:compression-filter=5 \
# -define png:compression-level=9 \
# -define png:compression-strategy=1 \
# -define png:exclude-chunk=all \
# -interlace none \
# -colorspace sRGB \
# -strip "$src"
Loading…
Cancel
Save