INNER CODE UNIT · Python
import_original
WenyuChiou/awesome-agentic-ai-zh · scripts/build-banner.py:213
def import_original(locale):
from PIL import Image
relative = f'resources/diagrams/banner{LOCALES[locale]["suffix"]}.png'
original = subprocess.check_output(["git", "show", f"{SOURCE_COMMIT}:{relative}"], cwd=ROOT)
with Image.open(io.BytesIO(original)) as image:
if image.size != (1672, 941):
raise ValueError("Original canvas changed")
buffer = io.BytesIO()
# High-quality compression preserves the artwork, not pixel identity.
# No resizing, repainting, text replacement, or generated icons.
image.save(buffer, format="WEBP", quality=95, method=6)
return buffer.getvalue()
def build_svg(locale, art=None):
art = read_art(locale) if art is None else art
t = LOCALES[locale]