about summary refs log tree commit diff
path: root/edit.mk
blob: fdedf565d31e124bdf8ee6eab175fedb97207260 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
commit:
	@ git add -v -- $(shell git ls-files -dmo site/ links/ media/ src/inc/ | fzf -m)
	@ git commit -m "% update site" -esS

edit:
	@ ${EDITOR} src/inc/$(shell pushd src/inc >/dev/null && git ls-files -c . | fzf -m --bind=ctrl-c:accept-or-print-query)

change:
	@ ${MAKE} edit
	@ ${MAKE} gen
	@ ${MAKE} commit

.PHONY: commit edit change

IN    ?=
OUT   ?=
SCALE ?= x400

compress:
    # => https://kokorobot.ca/site/image_optimization.html
	magick $(IN) \
        -sampling-factor 4:2:0 \
        -strip \
        -quality 85 \
        -interlace line \
        -scale $(SCALE) \
        $(OUT)
	exiftool -overwrite_original_in_place -all= -tagsFromFile @ -Orientation $(OUT)
        # -colorspace sRGB \

dither:
    # => https://legacy.imagemagick.org/Usage/quantize/#ordered-dither
	magick $(IN) \
        -sampling-factor 4:2:0 \
        -strip \
        -quality 85 \
        -interlace line \
        -ordered-dither o3x3 \
        -scale $(SCALE) \
        $(OUT)
        # -colorspace Gray \

.PHONY: compress dither

readcover: SCALE = x150
readcover: OUT   = ./media/content/read/$(notdir $(IN))
readcover: compress

.PHONY: readcover