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

  1. 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.
  2. Match stars: Using a reference star catalog (bright stars) and a KDTree to snap labels to nearest detected stars.
  3. 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

    1. Clone: git clone https://github.com/stephen-n-zhou/star-map-annotator (or add this as a subfolder in your site repo)
    2. Install: pip install pillow numpy scipy pandas
    3. 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