diff --git a/README.md b/README.md index 7c3f327..b91afaf 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,16 @@ My personal website. + ## Getting started ```bash npm i npm run dev ``` + + +## Images + +The original pictures are in the `public-src` directory. +The `convert-images.py` script converts them into the required formats and resolutions. diff --git a/convert-images.py b/convert-images.py index 44b9b28..3a1085b 100644 --- a/convert-images.py +++ b/convert-images.py @@ -9,6 +9,11 @@ def main(): def convert_favicon(): + """ + Generate different versions of an icon from a vector image. + The function does not overwrite existing files. + """ + root = 'public/favicon' src = f'{root}/vector.svg' @@ -37,7 +42,16 @@ def convert_favicon(): print(' '.join(cmd)) subprocess.run(cmd) + def convert_images(src, dest): + """ + Convert all images from the public-src directory. + The function does not overwrite existing files. + + Example: + public-src/subdir/1.jpg -> public/subdir/1.avif + """ + for i in listdir(src): entry = join(src, i)