Commit 90e8b926 authored by lunasorcery's avatar lunasorcery
Browse files

tweak imagemagick commandline for better windows compatibility

parent 4739b76b
...@@ -77,7 +77,7 @@ if not os.path.exists('gen/favicon.ico'): ...@@ -77,7 +77,7 @@ if not os.path.exists('gen/favicon.ico'):
for size in faviconSizes: for size in faviconSizes:
os.system(f"inkscape -w {size} -h {size} -o gen/favicon-{size}.png icons/favicon.svg") os.system(f"inkscape -w {size} -h {size} -o gen/favicon-{size}.png icons/favicon.svg")
faviconPngs = [f"gen/favicon-{size}.png" for size in faviconSizes] faviconPngs = [f"gen/favicon-{size}.png" for size in faviconSizes]
os.system(f"convert {' '.join(faviconPngs)} gen/favicon.ico") os.system(f"magick convert {' '.join(faviconPngs)} gen/favicon.ico")
for faviconPng in faviconPngs: for faviconPng in faviconPngs:
os.remove(faviconPng) os.remove(faviconPng)
...@@ -130,19 +130,19 @@ for idx,prod in enumerate(prods): ...@@ -130,19 +130,19 @@ for idx,prod in enumerate(prods):
#shutil.copyfile(src_jpg, dst_jpg) #shutil.copyfile(src_jpg, dst_jpg)
# actually, let's make sure it's progressive # actually, let's make sure it's progressive
os.system(f"convert -interlace Plane -quality 95 {src_jpg} {dst_jpg}") os.system(f"magick convert -interlace Plane -quality 95 {src_jpg} {dst_jpg}")
prods[idx]['image_url'] = f"img/{slug}.jpg" prods[idx]['image_url'] = f"img/{slug}.jpg"
# if we've made it bigger, ditch the quality=95 flag # if we've made it bigger, ditch the quality=95 flag
if os.path.getsize(dst_jpg) > os.path.getsize(src_jpg): if os.path.getsize(dst_jpg) > os.path.getsize(src_jpg):
os.system(f"convert -interlace Plane {src_jpg} {dst_jpg}") os.system(f"magick convert -interlace Plane {src_jpg} {dst_jpg}")
print(f" src_jpg: {os.path.getsize(src_jpg): 10,}b") print(f" src_jpg: {os.path.getsize(src_jpg): 10,}b")
print(f" dst_jpg: {os.path.getsize(dst_jpg): 10,}b") print(f" dst_jpg: {os.path.getsize(dst_jpg): 10,}b")
elif os.path.exists(src_png): elif os.path.exists(src_png):
# if the source is a png, resave it as a jpg # if the source is a png, resave it as a jpg
os.system(f"convert -interlace Plane -quality 95 {src_png} {dst_jpg}") os.system(f"magick convert -interlace Plane -quality 95 {src_png} {dst_jpg}")
# ...and use the smaller one # ...and use the smaller one
print(f" src_png: {os.path.getsize(src_png): 10,}b") print(f" src_png: {os.path.getsize(src_png): 10,}b")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment