Read-only mirror of the client's existing system as it stood before our work began. Taken from matthijsexpand@149.210.159.152 (TransIP VPS, Lelystad NL) with the client's written permission. Contents: - home-weddingcaketopper/ Next.js app, proxy.py, supabase schema - var-www/ static webroots for all three domains - etc-nginx/ vhost configs (previously unversioned, server-only) Excluded: node_modules (704M, regenerable), .next (17M, regenerable), and env file contents (present on local disk, gitignored — see README). Not our IP. Not covered by the proposal's assignment clause.
23 lines
789 B
Python
23 lines
789 B
Python
from PIL import Image
|
|
import os, numpy as np
|
|
|
|
def reset_image(src):
|
|
img = Image.open(src).convert('RGBA')
|
|
w, h = img.size
|
|
arr = np.array(img)
|
|
non_white = np.where(np.any(arr[:,:,:3] < 230, axis=(1,2)))[0]
|
|
if len(non_white) == 0: return
|
|
top = non_white[0]
|
|
bottom = non_white[-1]
|
|
if top / h < 0.05:
|
|
print(f"Skip: {os.path.basename(src)}"); return
|
|
margin = int(h * 0.03)
|
|
new_top = max(0, top - margin)
|
|
new_bot = min(h, bottom + margin)
|
|
cropped = img.crop((0, new_top, w, new_bot))
|
|
cropped.save(src, 'PNG')
|
|
print(f"Reset: {os.path.basename(src)}")
|
|
|
|
for dirpath, dirs, files in os.walk('/var/www/3dcaketopper.nl/verjaardag/images'):
|
|
for f in files:
|
|
if f.lower().endswith('.png'): reset_image(os.path.join(dirpath, f))
|