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:
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
@@ -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()}')
|
||||
|
||||
Reference in New Issue
Block a user