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://yusufeminoglu.github.io/MyFace2City/

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

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.0
File Size Uploaded
myface2city-0.12.0.tar.gz 48.1 kB Details

Built distribution (wheel)

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

Total release size: 104.0 kB

Release files / myface2city-0.12.0.tar.gz

Download URL myface2city-0.12.0.tar.gz
Size 48.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dc9424d521a9950cae5c6564f87ed03aad98ce46ee3c99d505883df03ed636a5
BLAKE2b-256 checksum
How to use checksums
75f33f7b1f4a01493b8dddeda56f54e3e660d6313a046ba498f20aebb6bb4fa1
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.0-py3-none-any.whl

Download URL myface2city-0.12.0-py3-none-any.whl
Size 55.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c204fb2376f94913dfa7a7c1a4555da98a20cdd417c9b236a0c51665f18cf1e6
BLAKE2b-256 checksum
How to use checksums
35a9ca228cb0f951edb33de2b1455fa85b4109cfa22293294541af8db2b93929
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.0 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