Update 'app.py'

main
poni 6 months ago
parent d2345731b4
commit 3d568cfc0a

@ -180,7 +180,7 @@ def prepare_project():
for image_file in image_files:
if not image_file.startswith('compress') and image_file != '.DS_Store':
# print(image_file)
subprocess.run(["magick", os.path.join(assets_dir, image_file), "-resize", "80%", "-define", "jpeg:extent=512kb", os.path.join(assets_dir, image_file)])
subprocess.run(["magick", os.path.join(assets_dir, image_file), "-unsharp", "0.25x0.25+8+0.065", "-resize", "1280x1024\>", "-density", "180", os.path.join(assets_dir, image_file)])
os.rename(os.path.join(assets_dir, image_file), os.path.join(assets_dir, 'compressed_'+image_file.replace(' ', '_')))
image_files = [f for f in sorted(os.listdir(assets_dir)) if os.path.isfile(os.path.join(assets_dir, f))]
@ -331,7 +331,7 @@ def generate_website():
# Compress/resize images
for gallery_pic in gallery_pics:
if not gallery_pic.startswith('compress') and gallery_pic != '.DS_Store':
subprocess.run(["magick", os.path.join('website/galleria', gallery_pic), "-resize", "80%", "-define", "jpeg:extent=512kb", os.path.join('website/galleria/', gallery_pic)])
subprocess.run(["magick", os.path.join('website/galleria', gallery_pic), "-unsharp", "0.25x0.25+8+0.065", "-resize", "1280x1024\>", "-density", "180", os.path.join('website/galleria/', gallery_pic)])
os.rename(os.path.join('website/galleria', gallery_pic), os.path.join('website/galleria', 'compressed_'+gallery_pic.replace(' ', '_')))
# Initialize Jinja environment

Loading…
Cancel
Save