MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / render_all_sizes

Function render_all_sizes

scripts/generate_assets.py:329–352  ·  view source on GitHub ↗

Render the SVG at all icon sizes, applying sharpening where configured.

(inkscape: str, work_dir: Path)

Source from the content-addressed store, hash-verified

327
328
329def render_all_sizes(inkscape: str, work_dir: Path) -> list[Image.Image]:
330 """Render the SVG at all icon sizes, applying sharpening where configured."""
331 images = []
332 for size in RASTER_SIZES:
333 png_path = work_dir / f"icon_{size}.png"
334 if size == 16:
335 print(f" Using hand-crafted {size}x{size} icon...")
336 img = make_icon_16()
337 img.save(png_path)
338 else:
339 svg_path = SVG_FOR_SIZE[size]
340 print(f" Rendering {size}x{size} using {svg_path.name}...")
341 render_svg(inkscape, svg_path, png_path, size, size)
342 img = Image.open(png_path).copy()
343 if size in SHARPEN_AMOUNT:
344 img = img.filter(
345 ImageFilter.UnsharpMask(
346 radius=SHARPEN_RADIUS, percent=SHARPEN_AMOUNT[size], threshold=0
347 )
348 )
349 print(f" Sharpened {size}x{size} (USM {SHARPEN_AMOUNT[size]}%)")
350 img.save(png_path)
351 images.append(img)
352 return images
353
354
355def main():

Callers 1

mainFunction · 0.85

Calls 4

make_icon_16Function · 0.85
render_svgFunction · 0.85
saveMethod · 0.80
filterMethod · 0.80

Tested by

no test coverage detected