Skip to main content

MyFace2City — Optical Urban Portrait & Generative Cartography Engine

MyFace2City Logo

PyPI PyPI Downloads Documentation License: MIT CI


📖 Overview

MyFace2City is a pure-Python generative cartography and optical portrait engine. It turns road networks, building footprints, land-use boundaries, and vector parcels into live optical portraits.

By binding a raster face/portrait photo to a geographic frame, each vector feature samples underlying image luminance and receives a reversible, rule-based cartographic style—without mutating source geometries or attributes.


✨ Features

  • 🎭 UrbanPortrait Engine: Live luminance sampling with distortion-free aspect-ratio fitting.
  • 🎨 10 Curated Art Presets: Ink Portrait, Neon Night, Blueprint, Sepia Blocks, Negative City, Cyberpunk 2077, Vintage Engraving, Thermal Heatmap, Emerald Eco-Map, and Nordic Slate.
  • 🔘 Algorithmic Halftone & Vector Stippling: Generates variable-radius engraving dot grids across geographic regions.
  • 🗺️ OpenStreetMap Acquisition (Overpass API): Built-in client to fetch roads and buildings for any bounding box.
  • 🖼️ Standalone Scalable Vector SVG Exporter: Generates high-resolution SVG posters with dark/light themes and glowing underlays.
  • ⚙️ Smart Image Enhancement: Automatic histogram quantile contrast stretching, gamma correction, inversion, and edge emphasis.
  • 💻 CLI Interface: Fast command-line rendering (myface2city render, myface2city stipple, myface2city presets).

🚀 Quick Start

Installation

pip install myface2city

Python API

import myface2city as mfc

# 1. Initialize portrait engine with image and geographic bounds
bounds = (27.10, 38.40, 27.20, 38.50)  # (min_lon, min_lat, max_lon, max_lat)
portrait = mfc.UrbanPortrait("face.jpg", bounds)

# 2. Fetch OSM vector roads & buildings or load local GeoJSON
geojson_data = mfc.fetch_osm_network(bounds)

# 3. Apply optical portrait styling with Cyberpunk preset
styled_geojson = portrait.process_geojson(geojson_data, palette="Cyberpunk 2077")

# 4. Export high-resolution standalone vector SVG poster
mfc.export_svg(styled_geojson, "urban_portrait.svg", preset="Cyberpunk 2077")

Halftone Vector Stippling

import myface2city as mfc
from PIL import Image

img = Image.open("face.jpg").convert("L")
w, h = img.size
pixels = img.load()

# Define sampling callback
def sample_fn(u: float, v: float) -> float:
    px = int(max(0.0, min(1.0, u)) * (w - 1))
    py = int(max(0.0, min(1.0, v)) * (h - 1))
    return float(pixels[px, py])

# Generate 80x80 halftone stipple dot grid
points = mfc.calculate_stipple_points(
    0.0, 0.0, 100.0, 100.0,
    grid_cols=80, grid_rows=80,
    sample_fn=sample_fn,
    max_radius=4.0,
    preset="Ink Portrait"
)

stipple_geojson = mfc.stipple_to_geojson(points)
mfc.export_svg(stipple_geojson, "stipple_art.svg", preset="Ink Portrait")

💻 CLI Usage

# List all 10 art presets
myface2city presets

# Render face onto OpenStreetMap network
myface2city render --image face.jpg --osm-bbox 27.10,38.40,27.20,38.50 --preset "Cyberpunk 2077" --output portrait.svg

# Generate halftone stippling engraving
myface2city stipple --image face.jpg --cols 90 --rows 90 --preset "Vintage Engraving" --output engraving.svg

📜 License

MIT License © 2026 Yusuf Eminoğlu.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myface2city-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

myface2city-0.1.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file myface2city-0.1.0.tar.gz.

File metadata

  • Download URL: myface2city-0.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for myface2city-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4112d8c4ac49c68fe3b11948218e184536588e4ffaabcadfe6fc22c4a365d3b0
MD5 29c970c9e09a89da84434fc8354a7196
BLAKE2b-256 9cd8eb7995f4561a985eae91c881106bea4a3b71e7eb6653078af46a6d29797c

See more details on using hashes here.

Provenance

The following attestation bundles were made for myface2city-0.1.0.tar.gz:

Publisher: publish.yml on YusufEminoglu/MyFace2City

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file myface2city-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: myface2city-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for myface2city-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9f06155cd7796ca5b693a94dd77fd87f43dc673d2e18663eb4362721159abc6
MD5 9193665431b8c450803cffedb3cb74d1
BLAKE2b-256 22acb9f9bdab48bed430cee90eafffca7495b539af8e17bedcc0a2916d82ec4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for myface2city-0.1.0-py3-none-any.whl:

Publisher: publish.yml on YusufEminoglu/MyFace2City

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page