Update 'app.py'

main
poni 3 weeks ago
parent d2345731b4
commit 3d568cfc0a

@ -180,7 +180,7 @@ def prepare_project():
for image_file in image_files: for image_file in image_files:
if not image_file.startswith('compress') and image_file != '.DS_Store': if not image_file.startswith('compress') and image_file != '.DS_Store':
# print(image_file) # 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(' ', '_'))) 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))] 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 # Compress/resize images
for gallery_pic in gallery_pics: for gallery_pic in gallery_pics:
if not gallery_pic.startswith('compress') and gallery_pic != '.DS_Store': 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(' ', '_'))) os.rename(os.path.join('website/galleria', gallery_pic), os.path.join('website/galleria', 'compressed_'+gallery_pic.replace(' ', '_')))
# Initialize Jinja environment # Initialize Jinja environment

Loading…
Cancel
Save