-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (26 loc) · 1.04 KB
/
Makefile
File metadata and controls
30 lines (26 loc) · 1.04 KB
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
# Define the folder_ORIGINALS containing the original (coloured) images of the mentors
FOLDER_ORIGINALS = ./static/mentors/originals
# Define the JSON file
JSON_FILE = ./data/mentors_actual.json
# Target to convert the image to grayscale using ImageMagick https://imagemagick.org/script/download.php
.PHONY: grayscale
grayscale:
IMAGES=$$(find ${FOLDER_ORIGINALS} -type f \( -iname "*.jpeg" -o -iname "*.jpg" -o -iname "*.png" \)); \
for img in $$IMAGES; do \
filename=$$(basename "$$img"); \
echo "Processing image: $$img with name $$filename"; \
magick "$$img" -resize 200x200^ -gravity center -extent 200x200 -colorspace Gray "./static/mentors/$$filename"; \
done
# Target to check if iamges in the json file exist in the static/mentors folder
.PHONY: check-images
check-images:
@echo "Checking images..."
@jq -r '.[].img' $(JSON_FILE) | while read img; do \
full_path="./static/mentors/$$img"; \
if [ -f "$$full_path" ]; then \
echo "Image $$full_path exists."; \
else \
echo "Image $$full_path is missing!"; \
exit 1; \
fi \
done