Files
anchor23/tools/downscale_colors.py
Marco Gallegos 939e62ee77 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
2026-01-20 12:25:08 -06:00

26 lines
731 B
Python

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]}")