aboutsummaryrefslogtreecommitdiff
path: root/webp/Makefile.single
diff options
context:
space:
mode:
authorBrian Woods2023-02-22 01:09:37 -0500
committerBrian Woods2023-02-22 01:13:11 -0500
commit8fe5bf1295799a63aca7a16469771e257e5cfc49 (patch)
treea3ab4aeb3a682c5039ce15a880fe0dae97ed4d8b /webp/Makefile.single
parent85f977cabc3f4bb976cec15bf2c2a2674542f424 (diff)
Add webp scripts and makefiles
Add scripts for testing compression quality and converting collections of pngs to webps.
Diffstat (limited to 'webp/Makefile.single')
-rw-r--r--webp/Makefile.single25
1 files changed, 25 insertions, 0 deletions
diff --git a/webp/Makefile.single b/webp/Makefile.single
new file mode 100644
index 0000000..c84a4b8
--- /dev/null
+++ b/webp/Makefile.single
@@ -0,0 +1,25 @@
+# SPDX-FileCopyrightText: 2023 Brian Woods
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+SRC_DIR=src
+OUT_DIR=high_quality
+WEBP_OPT=-near_lossless 60
+
+SRC=$(shell find src/ -type f -name '*.png')
+OUT=$(patsubst ${SRC_DIR}/%.png, ${OUT_DIR}/%.webp, $(SRC))
+
+.PHONY: all clean
+.SECONDARY: main-build
+
+all: pre-build main-build
+
+pre-build:
+ ( cd ${SRC_DIR}; find ./ -mindepth 1 -type d ) | xargs -I{} mkdir -p "${OUT_DIR}/{}"
+
+main-build: ${OUT}
+
+${OUT_DIR}/%.webp: ${SRC_DIR}/%.png
+ cwebp ${WEBP_OPT} "$<" -o "$@"
+
+clean:
+ rm -rf ${OUT_DIR}