@@ -21,6 +21,7 @@ class LogoOutput(NamedTuple):
2121 height : int
2222 source : Path
2323
24+
2425# Colors matching the SVG design
2526BG = (224 , 232 , 240 , 255 ) # #e0e8f0
2627FG = (42 , 53 , 69 , 255 ) # #2a3545
@@ -55,9 +56,15 @@ class LogoOutput(NamedTuple):
5556
5657LOGO_OUTPUTS : list [LogoOutput ] = [
5758 LogoOutput (REPO_DIR / "docs" / "_static" / "pyscenedetect_logo.png" , 900 , 422 , LOGO_SVG ),
58- LogoOutput (REPO_DIR / "docs" / "_static" / "pyscenedetect_logo_small.png" , 300 , 141 , LOGO_BG_SVG ),
59- LogoOutput (REPO_DIR / "website" / "pages" / "img" / "pyscenedetect_logo.png" , 640 , 300 , LOGO_BG_SVG ),
60- LogoOutput (REPO_DIR / "website" / "pages" / "img" / "pyscenedetect_logo_small.png" , 462 , 217 , LOGO_SVG ),
59+ LogoOutput (
60+ REPO_DIR / "docs" / "_static" / "pyscenedetect_logo_small.png" , 300 , 141 , LOGO_BG_SVG
61+ ),
62+ LogoOutput (
63+ REPO_DIR / "website" / "pages" / "img" / "pyscenedetect_logo.png" , 640 , 300 , LOGO_BG_SVG
64+ ),
65+ LogoOutput (
66+ REPO_DIR / "website" / "pages" / "img" / "pyscenedetect_logo_small.png" , 462 , 217 , LOGO_SVG
67+ ),
6168]
6269
6370SVG_FOR_SIZE : dict [int , Path ] = {
@@ -82,7 +89,7 @@ def make_icon_16() -> Image.Image:
8289 px [i , 0 ] = BG
8390 px [i , 15 ] = BG
8491
85- # Arm stripe gaps (rows 2– 4): clear pixels not part of a complete stripe.
92+ # Arm stripe gaps (rows 2- 4): clear pixels not part of a complete stripe.
8693 # A stripe x+y=s spans all 3 arm rows only when 5 <= s <= 16.
8794 for y in range (2 , 5 ):
8895 for x in range (1 , 15 ):
@@ -93,7 +100,7 @@ def make_icon_16() -> Image.Image:
93100 if not ((x + y ) % 4 < 2 and 5 <= (x + y ) <= 16 ):
94101 px [x , y ] = BG
95102
96- # Slate interior (rows 8– 12, cols 3– 12)
103+ # Slate interior (rows 8- 12, cols 3- 12)
97104 for y in range (8 , 13 ):
98105 for x in range (3 , 13 ):
99106 px [x , y ] = BG
@@ -117,7 +124,16 @@ def find_inkscape() -> str:
117124def render_svg (inkscape : str , svg : Path , output : Path , width : int , height : int ):
118125 """Render an SVG to a PNG at the given dimensions using Inkscape."""
119126 subprocess .run (
120- [inkscape , str (svg ), "--export-type=png" , f"--export-filename={ output } " , "-w" , str (width ), "-h" , str (height )],
127+ [
128+ inkscape ,
129+ str (svg ),
130+ "--export-type=png" ,
131+ f"--export-filename={ output } " ,
132+ "-w" ,
133+ str (width ),
134+ "-h" ,
135+ str (height ),
136+ ],
121137 check = True ,
122138 capture_output = True ,
123139 )
@@ -127,7 +143,8 @@ def render_logos(inkscape: str):
127143 """Render the logo SVG to all required PNG outputs."""
128144 print ("Rendering logo PNGs..." )
129145 for entry in LOGO_OUTPUTS :
130- print (f" { entry .path .relative_to (REPO_DIR )} ({ entry .width } x{ entry .height } ) [source: { entry .source .name } ]..." )
146+ rel_path = entry .path .relative_to (REPO_DIR )
147+ print (f" { rel_path } ({ entry .width } x{ entry .height } ) [source: { entry .source .name } ]..." )
131148 render_svg (inkscape , entry .source , entry .path , entry .width , entry .height )
132149 print (f" Done ({ len (LOGO_OUTPUTS )} files)." )
133150
@@ -147,7 +164,11 @@ def render_all_sizes(inkscape: str, work_dir: Path) -> list[Image.Image]:
147164 render_svg (inkscape , svg_path , png_path , size , size )
148165 img = Image .open (png_path ).copy ()
149166 if size in SHARPEN_AMOUNT :
150- img = img .filter (ImageFilter .UnsharpMask (radius = SHARPEN_RADIUS , percent = SHARPEN_AMOUNT [size ], threshold = 0 ))
167+ img = img .filter (
168+ ImageFilter .UnsharpMask (
169+ radius = SHARPEN_RADIUS , percent = SHARPEN_AMOUNT [size ], threshold = 0
170+ )
171+ )
151172 print (f" Sharpened { size } x{ size } (USM { SHARPEN_AMOUNT [size ]} %)" )
152173 img .save (png_path )
153174 images .append (img )
0 commit comments