SPB Git

Repository Public

make_images.py 6.6 KB 175 lines python

1#!/usr/bin/env python32# =============================================================================3#                  SP BOUCHER | SOFTWARE & RESEARCH4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# PROJECT METADATA8# -----------------------------------------------------------------------------9# Project          : FB Ka Automation10# File             : assets/make_images.py11# Description      : Génère la photo de profil et la couverture Facebook Groupe12#                    KA (style og.png).13# Module           : assets14# Repository       : https://git.spboucher.ai/fb-ka-automation15# Created          : 2026-12-0116# Last Modified    : 2026-12-0117#18# =============================================================================19# AUTHOR & PROFESSIONAL AFFILIATION20# =============================================================================21#22# Author           : Simon-Pierre Boucher23# Position         : Professor of Finance24# Institution      : Université du Québec en Outaouais (UQO)25# Department       : Département des sciences administratives26# Organization     : SP Boucher27#28# Website          : https://spboucher.ai29# Git              : https://git.spboucher.ai30#31# =============================================================================32# OFFICIAL CONTACT DIRECTORY33# =============================================================================34#35# General          : info@spboucher.ai36# Professional     : contact@spboucher.ai37# Direct           : simon@spboucher.ai38# Research         : research@spboucher.ai39# Development      : dev@spboucher.ai40# Support          : support@spboucher.ai41# Security/Admin   : admin@spboucher.ai42# Notifications    : notifications@spboucher.ai43#44# Preferred Contact: contact@spboucher.ai45#46# =============================================================================47# COPYRIGHT & INTELLECTUAL PROPERTY48# =============================================================================49#50# Copyright (c) 202651# Simon-Pierre Boucher52#53# All rights reserved where applicable.54#55# This file is governed by the applicable project license,56# copyright notices, institutional agreements and relevant law.57#58# Unless expressly authorized by the applicable license or59# rights holder, copying, redistribution, sublicensing,60# publication and commercial exploitation are not permitted.61#62# Existing third-party rights and notices remain unaffected.63#64# =============================================================================65# CONFIDENTIALITY & SECURITY66# =============================================================================67#68# Classification   : Public69# Distribution     : Public repository; use is governed by the project license70# Security Contact : admin@spboucher.ai71#72# Access to this source does not independently grant permission73# to redistribute or disclose confidential materials.74#75# Do not embed credentials, private keys, access tokens,76# certificates or confidential personal information.77#78# =============================================================================79# LICENSE & MAINTENANCE80# =============================================================================81#82# License          : None specified (no license file in this repository)83# Maintainer       : Simon-Pierre Boucher84# Technical Contact: dev@spboucher.ai85#86# =============================================================================87# END OF SP BOUCHER SOURCE HEADER88# =============================================================================8990"""Génère la photo de profil et la couverture Facebook Groupe KA (style og.png)."""91from PIL import Image, ImageDraw, ImageFont9293CHARCOAL = (20, 24, 20)94LIME = (217, 242, 107)95CREAM = (242, 241, 234)96DARKGREEN = (16, 92, 70)9798BLACK_F = "/System/Library/Fonts/Supplemental/Arial Black.ttf"99BOLD_F = "/System/Library/Fonts/Supplemental/Arial Bold.ttf"100MONO_F = "/System/Library/Fonts/Supplemental/Courier New Bold.ttf"101102103def f(path, size):104    return ImageFont.truetype(path, size)105106107def center_text(d, xy, text, font, fill):108    d.text(xy, text, font=font, fill=fill, anchor="mm")109110111# ---------- PROFIL 1024x1024 ----------112img = Image.new("RGB", (1024, 1024), CHARCOAL)113d = ImageDraw.Draw(img)114# subtil anneau lime115d.ellipse([52, 52, 972, 972], outline=(40, 48, 40), width=3)116# KA énorme en lime, centré (safe pour crop circulaire)117center_text(d, (512, 470), "KA", f(BLACK_F, 400), LIME)118# point médian + baseline119center_text(d, (512, 730), "·Ka = agréger", f(BOLD_F, 56), CREAM)120img.save("/tmp/ka_assets/profile.png")121122# ---------- COUVERTURE 1640x924 ----------123W, H = 1640, 924124img = Image.new("RGB", (W, H), CREAM)125d = ImageDraw.Draw(img)126127# cadre façon og.png128d.rounded_rectangle([18, 18, W - 18, H - 18], radius=28, outline=CHARCOAL, width=4)129130# En-tête eyebrow131d.line([70, 92, 120, 92], fill=DARKGREEN, width=6)132d.text((140, 92), "É C O S Y S T È M E   · K A   ·   Q U É B E C",133       font=f(BOLD_F, 30), fill=DARKGREEN, anchor="lm")134# pastilles palette à droite135for i, c in enumerate([LIME, CHARCOAL, CREAM]):136    x = W - 220 + i * 62137    d.rounded_rectangle([x, 66, x + 48, 114], radius=12, fill=c, outline=CHARCOAL, width=3)138139# Titre : Groupe [KA en boîte]140title_font = f(BLACK_F, 150)141gx, gy = 90, 210142d.text((gx, gy), "Groupe", font=title_font, fill=CHARCOAL)143gw = d.textlength("Groupe", font=title_font)144bx = gx + gw + 30145box = Image.new("RGBA", (420, 240), (0, 0, 0, 0))146bd = ImageDraw.Draw(box)147bd.rounded_rectangle([0, 0, 419, 239], radius=40, fill=CHARCOAL)148bd.text((210, 118), "KA", font=f(BLACK_F, 150), fill=LIME, anchor="mm")149box = box.rotate(-3, expand=True, resample=Image.BICUBIC)150img.paste(box, (int(bx), gy - 30), box)151152# Tagline153d.text((95, 470), "Mille sites. Un seul ·Ka.", font=f(BOLD_F, 62), fill=CHARCOAL)154d.text((95, 560), "10 agrégateurs + 1 moteur de recherche — 100 % automatisés, zéro boîte noire.",155       font=f(BOLD_F, 34), fill=(90, 95, 88))156157# Bande charbon en bas avec les plateformes158d.rounded_rectangle([18, 660, W - 18, H - 18], radius=28, fill=CHARCOAL)159sites = ["trouve-ka", "lou-ka", "immo-ka", "vrai-prix", "auto-ka", "fabri-ka",160         "food-ka", "resto-ka", "sorti-ka", "crea-ka"]161mono = f(MONO_F, 33)162x, y = 70, 705163for s in sites:164    txt = s + ".com"165    wlen = d.textlength(txt, font=mono)166    if x + wlen > W - 70:167        x = 70168        y += 62169    d.text((x, y), txt, font=mono, fill=LIME)170    x += wlen + 46171d.text((70, H - 78), "WWW.GROUPE-KA.COM", font=f(MONO_F, 36), fill=CREAM)172d.text((W - 70, H - 78), "·Ka = agréger", font=f(BOLD_F, 36), fill=LIME, anchor="ra")173img.save("/tmp/ka_assets/cover.png")174print("OK profile.png + cover.png")175
Files main
Menu

Theme