mirror of
https://github.com/marcogll/anchor23.git
synced 2026-03-15 14:24:19 +00:00
Refactor repository structure for clarity and professionalism
- Move scripts to tools/ directory - Rename pyton.py to generate_swatches.py - Rename down.py to downscale_colors.py - Remove hardcoded API key from generate_swatches.py - Update README.md to reference local color assets instead of placeholders
This commit is contained in:
25
tools/downscale_colors.py
Normal file
25
tools/downscale_colors.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from PIL import Image
|
||||
import os
|
||||
|
||||
# =========================
|
||||
# CONFIGURACIÓN
|
||||
# =========================
|
||||
INPUT_DIR = "assets/colors"
|
||||
OUTPUT_SIZE = (32, 32) # cambia a (24, 24) si lo prefieres
|
||||
|
||||
SUPPORTED_EXTENSIONS = (".png", ".jpg", ".jpeg", ".webp")
|
||||
|
||||
# =========================
|
||||
# DOWNSCALE
|
||||
# =========================
|
||||
for filename in os.listdir(INPUT_DIR):
|
||||
if filename.lower().endswith(SUPPORTED_EXTENSIONS):
|
||||
path = os.path.join(INPUT_DIR, filename)
|
||||
|
||||
with Image.open(path) as img:
|
||||
img = img.convert("RGB")
|
||||
img = img.resize(OUTPUT_SIZE, Image.Resampling.LANCZOS)
|
||||
img.save(path, optimize=True)
|
||||
|
||||
print(f"Downscaled {filename} to {OUTPUT_SIZE[0]}x{OUTPUT_SIZE[1]}")
|
||||
|
||||
Reference in New Issue
Block a user