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.
21 lines
768 B
Python
21 lines
768 B
Python
from PIL import Image
|
|
import os, numpy as np
|
|
|
|
def pad_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
|
|
if non_white[0] / h > 0.05:
|
|
print(f"Skip: {os.path.basename(src)}"); return
|
|
pad_top = int(h * 0.13)
|
|
pad_bot = int(h * 0.08)
|
|
new_img = Image.new('RGBA', (w, h + pad_top + pad_bot), (255,255,255,255))
|
|
new_img.paste(img, (0, pad_top))
|
|
new_img.save(src, 'PNG')
|
|
print(f"Padded: {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'): pad_image(os.path.join(dirpath, f))
|