- Created script `generate_images.nu` to automate WebP/JPEG-XL conversions with low-res placeholders. - Added new source image `data_hub_1.png`. - Generated WebP and JPEG-XL assets for projects: carplexity, data_hub, endolingual, icons, parva, and tiles. - Created both high-quality and low-resolution variants for all project assets.
28 lines
918 B
Text
Executable file
28 lines
918 B
Text
Executable file
#!/usr/bin/env nu
|
|
|
|
# Generate low-res placeholders and high-res WebP and JPEG-XL versions of images
|
|
|
|
let images = (ls ...(glob *.{png,jpg,jpeg}) | get name)
|
|
|
|
mkdir webp
|
|
mkdir jxl
|
|
|
|
for image in $images {
|
|
let base = ($image | path parse | get stem)
|
|
let ext = ($image | path parse | get extension)
|
|
|
|
print $"Generating high-res WebP for ($image)"
|
|
magick $image -quality 85 $"webp/($base).webp"
|
|
|
|
print $"Generating high-res JPEG-XL for ($image)"
|
|
magick $image -quality 85 $"jxl/($base).jxl"
|
|
|
|
# Resize to 300px width, quality 20
|
|
print $"Generating low-res placeholder for ($image)"
|
|
magick $image -resize 300 -quality 20 $"webp/($base)_low.webp"
|
|
|
|
print $"Generating low-res JPEG-XL placeholder for ($image)"
|
|
magick $image -resize 300 -quality 20 $"jxl/($base)_low.jxl"
|
|
}
|
|
|
|
print "Generation complete. Check crates/frontend/assets/webp and crates/frontend/assets/jxl for new files."
|