Skip to content

Commit 6bde617

Browse files
Add and run a script which converts all of the cover images to webp
1 parent 1eb0ff7 commit 6bde617

File tree

311 files changed

+38
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

311 files changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
target_dir="game_selection"
4+
quality=90 # 0-100, 100 is best quality, 90 seems to be a good balance
5+
6+
# Check if cwebp is available
7+
if ! command -v cwebp >/dev/null 2>&1; then
8+
echo "Error: cwebp not found. Please install Google WebP tools (choco install webp)"
9+
exit 1
10+
fi
11+
12+
echo "Converting images to WebP (quality: $quality)..."
13+
echo "---"
14+
15+
for f in "$target_dir"/*.jpg "$target_dir"/*.jpeg "$target_dir"/*.png; do
16+
[ -f "$f" ] || continue
17+
18+
if [[ "$f" == *.webp ]]; then # Skip if already WebP
19+
continue
20+
fi
21+
22+
filename=$(basename "$f")
23+
base="${filename%.*}"
24+
webp_file="$target_dir/${base}.webp"
25+
26+
echo "Converting '$filename'..."
27+
28+
if cwebp -q "$quality" "$f" -o "$webp_file"; then
29+
echo " ✓ Done: ${base}.webp"
30+
rm "$f"
31+
echo " 🗑️ Deleted original: $filename"
32+
else
33+
echo " ✗ Failed: $filename"
34+
fi
35+
done
36+
37+
echo "---"
38+
echo "Conversion complete!"
-32.3 KB
Binary file not shown.
11.7 KB
-57.4 KB
Binary file not shown.
39.2 KB
-6.12 KB
Binary file not shown.
-83.7 KB
Binary file not shown.
-55.9 KB
Binary file not shown.
-62.2 KB
Binary file not shown.
-22.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)