Star Map Annotator
Python • Imaging • Astronomy — Annotate constellations and auto‑generate bilingual (EN/中文) captions for social posts.
Overview
This tool helps you mark constellations on night-sky photos, then produce ready-to-post bilingual captions with hashtags. It’s designed for simple weekend astrophotography as well as kid-friendly sky learning.
- Detect & place constellation labels from a star list (CSV/JSON).
- Draw smooth polylines for constellation asterisms.
- Export annotated image (PNG/JPEG) and caption text.
Demo



Place your own images at /assets/star-map/
to update these thumbnails.
How it works
- Plate approximation: With a known focal length & crop, approximate the mapping from RA/Dec → image (x,y). For casual use, you can place reference points manually.
- Match stars: Using a reference star catalog (bright stars) and a KDTree to snap labels to nearest detected stars.
- Render: Draw polylines (constellation lines) and text labels with a subtle outer glow for night readability.
# Minimal snippet: draw a labeled point with Pillow
from PIL import Image, ImageDraw, ImageFont
im = Image.open("input.jpg").convert("RGB")
draw = ImageDraw.Draw(im)
xy = (820, 460)
draw.ellipse((xy[0]-3, xy[1]-3, xy[0]+3, xy[1]+3), fill=(255,255,255))
draw.text((xy[0]+8, xy[1]-8), "Vega / 织女星", fill=(220,235,255))
im.save("annotated.jpg", quality=95)
Tip: to get nice line glow, draw the same polyline 2–3 times with decreasing width and increasing opacity.
Bilingual caption generator
Pick a preset and tweak; copy to clipboard for 小红书/Instagram:
Hashtag pool
Edit in JS if you want to customize.
Download & Run
- Clone:
git clone https://github.com/stephen-n-zhou/star-map-annotator
(or add this as a subfolder in your site repo) - Install:
pip install pillow numpy scipy pandas
- Run:
python annotate.py --input input.jpg --catalog bright_stars.csv --out annotated.jpg
If you want a browser-based version later, we can add a canvas tool with JSON catalogs.
Roadmap
- JS web demo with drag‑drop image and manual 2‑point calibration
- Batch annotate & export with templates
- Optional star databases (Hipparcos/Tycho) with magnitude filtering