SPB Git

Repository Public

make-icon.py 3.4 KB 71 lines python

1#!/usr/bin/env python32# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : MacLustr SMS Gateway8# File             : ios/Scripts/make-icon.py9# Description      : Dessine l'icône de l'app et la marque de lancement (carte10#                    SIM à coin coupé, barres de signal) — même identité que le11#                    tableau de bord et l'app Android.12# Module           : ios13# Repository       : https://git.spboucher.ai/maclustr-sms14# Project Website  : https://sms.spboucher.ai15# Created          : 2026-11-3016# Last Modified    : 2026-11-3017#18# Author           : Simon-Pierre Boucher19# Position         : Professor of Finance20# Institution      : Université du Québec en Outaouais (UQO)21# Organization     : SP Boucher22# Website          : https://spboucher.ai23# Git              : https://git.spboucher.ai24#25# Preferred Contact: admin@spboucher.ai26# Technical Contact: dev@spboucher.ai27# Security/Admin   : admin@spboucher.ai28#29# Copyright (c) 202630# Simon-Pierre Boucher31# All rights reserved where applicable. This file is governed by the32# applicable project license, copyright notices and relevant law.33# Existing third-party rights and notices remain unaffected.34#35# License          : None specified (no license file in this repository)36#37# Do not embed credentials, private keys, access tokens,38# certificates or confidential personal information.39#40# =============================================================================41# END OF SP BOUCHER SOURCE HEADER42# =============================================================================4344from PIL import Image, ImageDraw45import os, sys46INK, TEXT, GREEN = (18, 22, 27), (233, 236, 232), (95, 191, 143)47def mark(size, bg, scale=1.0, fg=TEXT):48    S = size * 4                                           # suréchantillonnage ×4 pour des bords nets49    im = Image.new("RGBA", (S, S), bg)50    d = ImageDraw.Draw(im)51    m = S * (1 - scale) / 252    def P(x, y): return (m + x * S * scale, m + y * S * scale)53    lw = int(S * scale * 0.052)54    pts = [P(.27, .16), P(.585, .16), P(.755, .33), P(.755, .84), P(.27, .84)]55    d.line(pts + [pts[0], pts[1]], fill=fg, width=lw, joint="curve")56    for (x, y) in pts: d.ellipse([x - lw / 2, y - lw / 2, x + lw / 2, y + lw / 2], fill=fg)57    base, bw = .74, .07858    for i, h in enumerate([.13, .23, .33]):59        x0 = .365 + i * .11360        a, b = P(x0, base - h), P(x0 + bw, base)61        d.rounded_rectangle([a[0], a[1], b[0], b[1]], radius=S * scale * .012, fill=fg if i == 2 else GREEN)62    return im.resize((size, size), Image.LANCZOS)63out = sys.argv[1]64icon = mark(1024, INK + (255,), .92)65# léger relief : halo vert très discret en bas à gauche, sans dégradé criard66glow = Image.new("RGBA", (1024, 1024), (0, 0, 0, 0)); g = ImageDraw.Draw(glow)67for r in range(520, 0, -8): g.ellipse([120 - r, 1010 - r, 120 + r, 1010 + r], fill=GREEN + (max(0, int(10 * (1 - r / 520))),))68base = Image.new("RGBA", (1024, 1024), INK + (255,)); base.alpha_composite(glow); base.alpha_composite(mark(1024, (0, 0, 0, 0), .92))69base.convert("RGB").save(os.path.join(out, "AppIcon.appiconset/icon-1024.png"))70for s, n in [(96, ""), (192, "@2x"), (288, "@3x")]: mark(s, (0, 0, 0, 0), 1.0).save(os.path.join(out, f"LaunchMark.imageset/mark{n}.png"))71
Files main
Menu

Theme