Skip to main content

MyFace2City — Optical Urban Portrait & Generative Cartography Engine

MyFace2City Logo

PyPI PyPI Downloads Documentation License: MIT CI


🌐 Live Interactive Studio & Documentation

Explore the in-browser Generative Cartography Studio and comprehensive technical reference manual:

👉 https://geophilo.com/

Upload any portrait photo, choose from 10 curated artistic presets, and export scalable SVG posters directly in your browser.


📖 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.

Metadata

Release files for myface2city 0.12.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for myface2city 0.12.1
File Size Uploaded
myface2city-0.12.1.tar.gz 48.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for myface2city 0.12.1
File Interpreter ABI Platform
myface2city-0.12.1-py3-none-any.whl Python 3 none any Details

Total release size: 103.9 kB

Release files / myface2city-0.12.1.tar.gz

Download URL myface2city-0.12.1.tar.gz
Size 48.0 kB
Tags Source
SHA-256 checksum
How to use checksums
790c1be784c090fd2594cfe8e7b93a64b28cf2b9d290a8f118a6f4eed8e224a8
BLAKE2b-256 checksum
How to use checksums
aed3aed6d7ba2ac86572e352f05b6e89b674e4e61d8dc62bd073414663de7524
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / myface2city-0.12.1-py3-none-any.whl

Download URL myface2city-0.12.1-py3-none-any.whl
Size 55.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca2749de79fbb63c907830a7080f47369ee87ca561ba567be141f7ce4d20c499
BLAKE2b-256 checksum
How to use checksums
deefe059e770989b57270da0cfd401c928210ad3526ed6fa68526cc496f971a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.12.1 This release

2 release files

0.1.1

2 release files

0.1.0

2 release 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