fix(tooling): star map generator outputs both SVG and PNG

Script now auto-converts to PNG after generating SVG. Tries magick,
convert, or rsvg-convert in order.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 11:12:02 +01:00
co-authored by Claude Opus 4.6
parent f9373be3ba
commit a6ce4797d8
2 changed files with 20 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

+20
View File
@@ -331,3 +331,23 @@ with open(output_path, 'w') as f:
print(f'Written to {output_path}')
print(f'{len(positions)} nodes, {len(starmap["edges"])} edges')
print(f'Hops 0-{FOLD_HOP-1} individual, {FOLD_HOP}+ folded ({len(hop_groups.get(FOLD_HOP, []))} nodes)')
# Also render PNG
import shutil, subprocess
png_path = output_path.replace('.svg', '.png')
if shutil.which('magick'):
cmd = ['magick', '-density', '150', '-background', '#0a0a1a', output_path, png_path]
elif shutil.which('convert'):
cmd = ['convert', '-density', '150', '-background', '#0a0a1a', output_path, png_path]
elif shutil.which('rsvg-convert'):
cmd = ['rsvg-convert', '-d', '150', '-p', '150', '-b', '#0a0a1a', '-o', png_path, output_path]
else:
cmd = None
print('No SVG-to-PNG converter found (tried magick, convert, rsvg-convert). PNG not generated.')
if cmd:
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode == 0:
print(f'PNG written to {png_path}')
else:
print(f'PNG conversion failed: {result.stderr.strip()}')