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.

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.1.tar.gz (19.6 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.1-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: myface2city-0.1.1.tar.gz
  • Upload date:
  • Size: 19.6 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.1.tar.gz
Algorithm Hash digest
SHA256 42f15292301f9d283b9e59c05924bcd3126be0b260cf39a762a5302f60d80cf7
MD5 ec00dcf25580dce4ae0426997b5bbdc9
BLAKE2b-256 6f22fe97a4642a43b61f05ba2939a153616366483a070f993bb923d6bf824d14

See more details on using hashes here.

Provenance

The following attestation bundles were made for myface2city-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: myface2city-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 689dc00196cd2b96281528dc99610872368f010c9d8210ed735bcffb085ab712
MD5 b45bc843c57bf49be0625f8cce04b132
BLAKE2b-256 344c2cfeb9a41343017c394fd97d229ce7bfee0af6c7aaf28030ad5dfdeb61e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for myface2city-0.1.1-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

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page