Add more info about `convert-images.py` script

pull/21/head
Ivan Reshetnikov 2023-12-03 20:33:55 +05:00
parent 5a89bd0a79
commit aed03b484d
No known key found for this signature in database
GPG Key ID: 56C7BAAE859B302C
2 changed files with 21 additions and 0 deletions

View File

@ -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.

View File

@ -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)