MyFace2City — Optical Urban Portrait & Generative Cartography Engine
📖 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4112d8c4ac49c68fe3b11948218e184536588e4ffaabcadfe6fc22c4a365d3b0
|
|
| MD5 |
29c970c9e09a89da84434fc8354a7196
|
|
| BLAKE2b-256 |
9cd8eb7995f4561a985eae91c881106bea4a3b71e7eb6653078af46a6d29797c
|
Provenance
The following attestation bundles were made for myface2city-0.1.0.tar.gz:
Publisher:
publish.yml on YusufEminoglu/MyFace2City
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
myface2city-0.1.0.tar.gz -
Subject digest:
4112d8c4ac49c68fe3b11948218e184536588e4ffaabcadfe6fc22c4a365d3b0 - Sigstore transparency entry: 2591080170
- Sigstore integration time:
-
Permalink:
YusufEminoglu/MyFace2City@bb39901ceaa5d0371983470ec37db89d86409360 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/YusufEminoglu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb39901ceaa5d0371983470ec37db89d86409360 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9f06155cd7796ca5b693a94dd77fd87f43dc673d2e18663eb4362721159abc6
|
|
| MD5 |
9193665431b8c450803cffedb3cb74d1
|
|
| BLAKE2b-256 |
22acb9f9bdab48bed430cee90eafffca7495b539af8e17bedcc0a2916d82ec4c
|
Provenance
The following attestation bundles were made for myface2city-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on YusufEminoglu/MyFace2City
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
myface2city-0.1.0-py3-none-any.whl -
Subject digest:
f9f06155cd7796ca5b693a94dd77fd87f43dc673d2e18663eb4362721159abc6 - Sigstore transparency entry: 2591080332
- Sigstore integration time:
-
Permalink:
YusufEminoglu/MyFace2City@bb39901ceaa5d0371983470ec37db89d86409360 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/YusufEminoglu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb39901ceaa5d0371983470ec37db89d86409360 -
Trigger Event:
release
-
Statement type: